Created
August 26, 2017 01:33
-
-
Save Sh1n0g1/8e98dcaf8df5f2951f1e52607a127191 to your computer and use it in GitHub Desktop.
Run C# code in PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$assemblies=( | |
"System" | |
) | |
$source=@" | |
using System; | |
namespace Helloworld | |
{ | |
public static class Hello{ | |
public static void Main(){ | |
Console.WriteLine("Hello, world!"); | |
} | |
} | |
} | |
"@ | |
Add-Type -ReferencedAssemblies $assemblies -TypeDefinition $source -Language CSharp | |
[HelloWorld.Hello]::Main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment