【发布时间】:2016-10-26 20:42:11
【问题描述】:
我刚开始使用 IronRuby。这是我的测试课:
class Program
{
static void Main(string[] args)
{
var path = @"C:\Users\frays\Desktop\test.rb";
var engine = Ruby.CreateEngine();
var scope = engine.Runtime.CreateScope();
scope.SetVariable("sendNext", new Action<string>(SendNext));
engine.ExecuteFile(path, scope);
Console.Read();
}
private static void SendNext(string text)
{
Console.WriteLine(text);
}
}
这是我的测试脚本:
sendNext 'heyyy'
但是,当尝试运行程序时,它会抛出一个异常 wrong number of arguments (1 for 0),即使该方法肯定将字符串作为参数。
【问题讨论】:
标签: ironruby