 | 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
SyntaxObject LoadMethod(
string code
)
Parameters
- code
- Type: SystemString
The C# script text.
Return Value
Type:
ObjectInstance of the first class defined in the script.
ExamplesThe 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