Click or drag to resize

IEvaluatorClone Method

Clones the parent IEvaluator.

This method returns a freshly initialized copy of the IEvaluator. The cloning 'depth' can be controlled by the copyRefAssemblies.

This method is a convenient technique when multiple IEvaluator instances are required (e.g. for concurrent script evaluation).

Namespace:  CSScriptLib
Assembly:  CSScriptLib (in CSScriptLib.dll) Version: 1.3.2.0
Syntax
C#
IEvaluator Clone(
	bool copyRefAssemblies = true
)

Parameters

copyRefAssemblies (Optional)
Type: SystemBoolean
if set to true all referenced assemblies from the parent IEvaluator will be referenced in the cloned copy.

Return Value

Type: IEvaluator
The freshly initialized instance of the IEvaluator.
Examples
var eval1 = CSScript.Evaluator.Clone();
var eval2 = CSScript.Evaluator.Clone();

var sub = eval1.LoadDelegate<Func<int, int, int>>(
                           @"int Sub(int a, int b) {
                                 return a - b;
                             }");

var sum = eval2.LoadDelegate<Func<int, int, int>>(
                           @"int Sub(int a, int b) {
                                 return a + b;
                             }");

var result = sum(7, sub(4,2));
See Also