【发布时间】:2012-01-03 16:06:11
【问题描述】:
我有一个看起来像这样的界面:
interface IMyInterface {
MyObject DoStuff(MyObject o);
}
我想在 IronRuby 中编写这个接口的实现,并将对象返回以供以后使用。
但是当我尝试做类似的事情时
var code = @"
class MyInterfaceImpl
include IMyInterface
def DoStuff(o)
# Do some stuff with o
return o
end
end
MyInterfaceImpl.new";
Ruby.CreateEngine().Execute<IMyInterface>(code);
我收到一个错误,因为它无法转换为 IMyInterface。是我做错了,还是不能做我想做的事?
【问题讨论】:
标签: c# ironruby dynamic-language-runtime