public virtual CorrectionResult RunMethod(_Assembly assembly, Question question) { var instance = assembly.CreateInstance(question.ContractDefinition.ClassName); var type = instance.GetType(); MethodInfo methodInfo = type.GetMethod(question.ContractDefinition.MethodName); return(new CorrectionResult { Result = methodInfo.Invoke(instance, null).ToString() }); }
public object Eval(string expression, IDictionary <object, object> args) { var sources = _codeGenerator.GetSources(_code, expression, _namespaces, _definitions); _Assembly asm = _compilerImpl.Compile(sources, _references); var obj = (IComparer <IDictionary <object, object> >)asm.CreateInstance("CoApp.Eval.GeneratedCode.Foo"); var result = new Dictionary <object, object>(); _permissions.PermitOnly(); obj.Compare(args, result); return(result[String.Empty]); }