Click or drag to resize

IEvaluatorLoadFileT Method (String, Object)

Evaluates and loads C# code from the specified file to the current AppDomain. Returns instance of the first class defined in the script file. After initializing the class instance it is aligned to the interface specified by the parameter T.

Note: the script class does not have to inherit from the T parameter as the proxy type will be generated anyway.

Namespace:  CSScriptLib
Assembly:  CSScriptLib (in CSScriptLib.dll) Version: 1.3.2.0
Syntax
C#
T LoadFile<T>(
	string scriptFile,
	params Object[] args
)
where T : class

Parameters

scriptFile
Type: SystemString
The C# script text.
args
Type: SystemObject
Optional non-default constructor arguments.

Type Parameters

T
The type of the interface type the script class instance should be aligned to.

Return Value

Type: T
Aligned to the T interface instance of the class defined in the script file.
Examples
The following is the simple example of the interface alignment:
public interface ICalc
{
    int Sum(int a, int b);
}
....
ICalc calc = CSScript.Evaluator
                     .LoadFile<ICalc>("calc.cs");

int result = calc.Sum(1, 2);
See Also