Skip to content

Instantly share code, notes, and snippets.

View F-Unction's full-sized avatar
💭
Gu gu gu~

F_Unction F-Unction

💭
Gu gu gu~
View GitHub Profile
@F-Unction
F-Unction / BlackInteractiveMagic.cs
Created February 3, 2022 10:38 — forked from TheSnowfield/SandBox.cs
Dynamically run C# code in the same context
static class BlackInteractiveMagic
{
private static readonly Type CompilerType =
Type.GetType("Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScriptCompiler, " +
"Microsoft.CodeAnalysis.CSharp.Scripting");
private static readonly Type ScriptBuilderType =
Type.GetType("Microsoft.CodeAnalysis.Scripting.ScriptBuilder, " +
"Microsoft.CodeAnalysis.Scripting");