在下面的代码片段中,我如何将我的对象作为参数传递给脚本中的方法?
var c = new MyAssembly.MyClass()
{
Description = "test"
};
var code = "using MyAssembly;" +
"public class TestClass {" +
" public bool HelloWorld(MyClass c) {" +
" return c == null;" +
" }" +
"}";
var script = CSharpScript.Create(code, options, typeof(MyAssembly.MyClass));
var call = await script.ContinueWith<int>("new TestClass().HelloWorld()", options).RunAsync(c);
CSharpSyntaxTree.ParseText
: http://www.tugberkugurlu.com/archive/compiling-c-sharp-code-into-memory-and-executing-it-with-roslyn - Tommy