[Ironruby-core] Is it possible to yield C# code?

Jonas Elfström jonelf at gmail.com
Mon Nov 29 17:52:01 EST 2010

I'm sorry if this is the wrong list. Please direct me if so.

This is not really something I'm losing sleep over but still I'm a
fair bit curious to know if it's possible to yield code that's not
Ruby from IronRuby. Is it?

The following C# gives me a wrong number of arguments (1 for 0) exception.

delegate void del(string s);

var rt = Ruby.CreateRuntime();
var eng = rt.GetEngine("rb");
            class YieldTest
              def test
                yield 'From IronRuby'
object test = eng.Runtime.Globals.GetVariable("YieldTest");
dynamic t = eng.Operations.CreateInstance(test);
t.test((del)(s => Console.WriteLine(s)));

See http://stackoverflow.com/questions/4189955/calling-ironruby-from-c-with-a-delegate

If this is not possible, is it then a kind of integration that is
planned for future releases of IronRuby?

Jonas Elfström

More information about the Ironruby-core mailing list