C# Language Runtime Compile RoslynScript

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript is a new C# script engine.

var code = "(1 + 2).ToString()";
var run = await CSharpScript.RunAsync(code, ScriptOptions.Default);
var result = (string)run.ReturnValue;
Console.WriteLine(result); //output 3

You can compile and run any statements, variables, methods, classes or any code segments.



Got any C# Language Question?