As a follow up to my last message, I wrote a small util method, as follows:
public static class Util
{
  public static T Cast<T>(object o)
  {
    return (T)o;
  }
}

And then try to call it from ruby:

x = Util.method(:cast).of(ICanDoStuff).call(mycomobject)

However, the Util.method(:cast).of(ICanDoStuff) fails with this error:

c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Protocols.cs:405:in
`ToType': invalid value for Class: ProxyLi
b::ICanDoStuff (ArgumentError)
        from
c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Protocols.cs:386:in
`ToTypes'
        from
c:\NB\DLR\18015\Languages\Ruby\Src\IronRuby.Libraries\Builtins\MethodOps.cs:75:in
`BindGenericParameters'
        from :0:in `of'
        from :0

Util.method(:cast).of(String) works fine however - is this because I'm
trying to pass in a .NET interface (which lives in an auto-generated interop
dll built by tlbimp) rather than a class?

Any help is much appreciated
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to