Beispiel #1
0
 /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
 /// <param name="code">The code or expression to compile.</param>
 /// <param name="parameterTypes">Parameter types used to compile the code or expression.</param>
 /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
 public Func <IDictionary, object> Compile(string code, IDictionary <string, Type> parameterTypes)
 {
     return(EvalCompiler.Compile <Func <IDictionary, object> >(this, code, parameterTypes, typeof(object), EvalCompilerParameterKind.Dictionary));
 }
Beispiel #2
0
 /// <summary>Compile the code or expression and return a delegate of type Func to execute.</summary>
 /// <param name="code">The code or expression to compile.</param>
 /// <returns>A delegate of type Func that represents the compiled code or expression.</returns>
 public Func <object> Compile(string code)
 {
     return(EvalCompiler.Compile <Func <object> >(this, code, null, typeof(object), EvalCompilerParameterKind.None));
 }
Beispiel #3
0
 /// <summary>Compile and evaluate the code or expression and return the result of type TResult.</summary>
 /// <typeparam name="TResult">Type of the result of the evaluted code or expression.</typeparam>
 /// <param name="code">The code or expression to evaluate.</param>
 /// <returns>The evaluated result of type TResult or null that represents the evaluted code or expression.</returns>
 public TResult Execute <TResult>(string code)
 {
     return(EvalCompiler.Compile <Func <TResult> >(this, code, null, typeof(TResult), EvalCompilerParameterKind.None)());
 }