C# Compiler Service and Runtime Evaulator.

The Mono.CSharp.dll assembly is a repackaging of Mono's C# compiler and provides access to the C# compiler as a service. It implements a C# eval. It allows applications to compile and execute C# statements and expressions at runtime.

This API is not yet final and will likely change as we get a better understanding of how developers will like to use the Mono C# Compiler Service. You can make a local copy of the Mono.CSharp.dll assembly and reference that locally as we are not commiting to the stability of this API yet.

The evaluator currently exposes a statement and expression API and will allow the consumer to execute statements or compute the value of expressions and get the results back. Support for compiling classes will appear in a future version. The method is a convenient way of executing expressions and stamtements and discarding the result. If you want to get the results of executing an expression use the method instead.

Variables declared during evaluation will continue to be made available on upcoming invocations. This allows variables to be declared and reused later.

The evaluator does not have direct access to any assemblies that are not explicitly referenced through the Evaluator's method.

The API exposes similar entry points, some are used for read-eval-print loops where more control over partial-input is required. Another set of entry points are provided when this functionality is not required.

The following are limitations in the Mono 2.2 API and will change in the future:

Using statements are currently global, once the using statement has been issued, it remains active.

If you want to create local variables that are not visible across multiple evaluations, you will have to create a new and invoke the compiler there.