Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C# in Powershell Scripts
$Source = @"
namespace CSharpPSTest
{
public static class PSTest
{
private static string _result = "Default Value";
public static string Get()
{
return "Get Success: " + _result;
}
public static string Set(string s)
{
_result = s;
return "Set Success: " + _result;
}
}
}
"@
Add-Type -TypeDefinition $Source -Language CSharp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment