Click or drag to resize

IEvaluatorLoadMethod Method (String)

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

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

Parameters

code
Type: SystemString
The C# script text.

Return Value

Type: Object
Instance of the first class defined in the script.
Examples
The following is the simple example of the LoadMethod usage:
dynamic script = CSScript.Evaluator
                         .LoadMethod(@"int Product(int a, int b)
                                       {
                                           return a * b;
                                       }");

int result = script.Product(3, 2);
See Also