So before I invoke the ire of SO purists, I am aware of When to develop using Powershell vs C#?. However I believe that the state of the art has changed since then.
So firstly the big take away from the last Powershell vs C# question was that inheriently Powershell is an interpreted language vs C# being a compiled language.
However I feel that as Roslyn matures this argument will hold no water.
So why do I want to learn Powershell. Given that:
C is by far the fastest of them all.
PowerShell has syntax that is related to 'C' languages. It is not a C language and does not work like any C language. PowerShell can create as many array dimensions as you want very easily.
I might hear someone say (or write) that PowerShell is not as performant than C#, so C# is better. This is… irrelevant, If we are scripting a task to be automated and repeated than performance is likely secondary and writing a nice easy to read and maintain script is what matters.
The C# program will be executed in a real . NET thread that is created in the Windows PowerShell script by using a helper class that is compiled in memory at runtime too. This helper class provides some synchronous . NET events that can be subscribed in Windows PowerShell to handle the console output.
To be precised PowerShell is much more for admins. It is because it gives similar tool (cmdlets) to manage different systems
But PowerShell is also very useful for developers when they are working on for example filesystem. Last week I had to find same string in many .NET solutions. Using 3 cmdlets I found what I needed in a second. Developing same in C# will take much time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With