public bool EvalExpressionNET(Parameter parameter) { StringBuilder statementBuilder = new StringBuilder() .AppendLine("new int[] {") .AppendJoin("," + Environment.NewLine, parameter.Statements) .AppendLine("}"); using (EvalContext context = new EvalContext()) { context.UseLocalCache = true; int[] results = context.Execute <int[]>(statementBuilder.ToString()); return(Assert(results, parameter.Sum)); } }
public static Type gettype(string s) { try { if (evalContext == null) { evalContext = new EvalContext(); evalContext.UseLocalCache = true; } //AppHelper.ShowInformation(typestring); var type = evalContext.Execute <Type>("typeof(" + s + ")"); return(type); } catch (Exception e) { return(null); } }