Jon*_*röm 5 c# delegates ironruby yield
是否可以使用委托作为参数从C#调用IronRuby方法,以便yield这样做?
以下给出了错误的参数数量(1表示0)异常.
Action<string> action = Console.WriteLine;
var runtime = Ruby.CreateRuntime();
var engine = runtime.GetEngine("rb");
engine.Execute(@"
class YieldTest
def test
yield 'From IronRuby'
end
end
");
object test = engine.Runtime.Globals.GetVariable("YieldTest");
dynamic t = engine.Operations.CreateInstance(test);
t.test(action);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
793 次 |
| 最近记录: |