[Ironruby-core] Calling .Net generic method with Ruby object

Alexander Ranger lists at ruby-forum.com
Wed Jul 18 06:22:53 UTC 2012

Hello. I've got this problem:

I'm having a .Net method with generics like this:

void Store<T>(T obj) where T : class, new();

And I'm trying to call it from IronRuby project with Ruby object as an

comp = Computer.new
#session is another user created .Net object, which has the method Store

And when I'm running the project an error pops up
"GenericArguments[0], "IronRuby.Builtins.RubyObject", in "Void
Store[T](T)" does not satisfy the restriction of the type parameter "T""

I guess that .Net generic just can't accept RubyObject as an argument.
But can I somehow bypass that restriction?

Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list