Skip to content

A library to help you debug your applicaations at runtime

License

Notifications You must be signed in to change notification settings

chairclr/CSharpEval

Repository files navigation

C# Eval

C# Eval is a library for running and debugging your code at runtime


Examples

Basic evaluation

// Create a basic evaluation context with no references or usings
BasicCSharpEvaluator evaluator = new BasicCSharpEvaluator(Enumerable.Empty<Assembly>(), Enumerable.Empty<string>());

evaluator.Eval("int x = 47;");
evaluator.Eval("int y = 3;");

Console.WriteLine(evaluator.Eval("(x + y) / 2").Result); // Prints 25

Importing a library and using

Assembly[] references = new Assembly[] { typeof(System.Console).Assembly };
string[] usings = new string[] { "System" };

// Create a basic evaluation context with a reference to the System library and a using System
BasicCSharpEvaluator evaluator = new BasicCSharpEvaluator(references, usings);

evaluator.Eval("Console.WriteLine(\"Hello From Eval\")");

About

A library to help you debug your applicaations at runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages