C# with PowerShell

I’m looking to have a play with C# with PowerShell . I have no experience with C#, wondering of anyone could recommend a book that might be helpful.thanks !

Hi Graham, maybe Doug’s book could be helpful to you:

And if you have a Pluralsight account, you can check out this course (it’s on my to-do list :slight_smile: ):

Thanks Richard, funny you should mention that book, I purchased it from Amazon this morning !

Hi Graham!

There are a few ways you could go about this. Richard mentioned the first: You could use C# to write PowerShell Cmdlets. You would certainly learn a bit about both PowerShell and C#, but that might be quite a steep task for your first dabble in C#.

Another option would be to just learn the basics of C#. You could compile and use C# on the fly in PowerShell, use csc.exe to compile your C# code, or play around with VS Code or Visual Studio itself - the community edition is a great free resource to learn with, but I’m personally starting to lean towards VS Code.

As for resources, I’ll let someone more knowledgeable answer - personally, I looked for free resources and experimented.

Good luck!

Thanks Warren that’s a good post and a couple of useful links. How do you say C#, is it ‘C plus’? Is there a huge differance between C# and F#? Seems like C# had similar syntax to powershell.

You can create classes using inline C# and compile them through Add-Type to give you a really quick way to get started

Excellent, thanks Richard.