19 September 2016

Powershell Power Boost

If you're new to Powershell or if you've been around the block a few times but have no background in C#, then you may benefit from the advantages of using C#.NET's List classes.  The class is fully documented here:

https://msdn.microsoft.com/en-us/library/6sh2ey19

Take a look.  There are multiple pre-built methods that come in very handy with Powershell scripts.  Some of my favorites are Count(), Contains(T), Reverse(), Sort() and many more.

Leveraging lists is easy once you've defined them in Powershell thusly:

$list = New-Object -TypeName System.Collections.Generic.List[String];

So go ahead and give List a try in your scripts... you'll never use arrays again!

Later
C

No comments:

Post a Comment

Comments are moderated only for the purpose of keeping pesky spammers at bay.

SharePoint Remote Event Receivers are DEAD!!!

 Well, the time has finally come.  It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...