Click or drag to resize

IEvaluatorCreateDelegate Method (String)

Wraps C# code fragment into auto-generated class (type name DynamicClass), evaluates it and loads the class to the current AppDomain.

Returns non-typed MethodDelegate for class-less style of invoking.

Namespace:  CSScriptLib
Assembly:  CSScriptLib (in CSScriptLib.dll) Version: 1.3.2.0
Syntax
C#
MethodDelegate CreateDelegate(
	string code
)

Parameters

code
Type: SystemString
The C# code.

Return Value

Type: MethodDelegate
The instance of a 'duck typed' MethodDelegate
Examples
var log = CSScript.Evaluator
                  .CreateDelegate(@"void Log(string message)
                                    {
                                        Console.WriteLine(message);
                                    }");

log("Test message");
See Also