Hi
How can I call a generic method (.NET 3.5 SP1) from IronRuby v0.9?
Trying to do something as obj.method(:method_name).of(String).call
seems not to work as "of" is an unknown method.
Thanks a lot
Hi
How can I call a generic method (.NET 3.5 SP1) from IronRuby v0.9?
Trying to do something as obj.method(:method_name).of(String).call
seems not to work as "of" is an unknown method.
Thanks a lot
It works for me (I'm using 0.9.1):
IronRuby:
obj = ClassLibrary1::Class1.new
obj.method(:test).of(String).call("test")
C#:
namespace ClassLibrary1
{
public class Class1
{
public string Test<T>(T param)
{
return param.ToString();
}
}
}
You can also use array indexers to pass generic arguments to methods, and you can execute a proc with array indexers as well, so Shay's example can look like this too:
obj.method(:test)[String]["test"]