How do I call overloaded generic methods in IronRuby?

How can I call an overloaded generic method in IronRuby?

I have a .NET class with the following methods. (Note that the methods are static)

Factory.cs
----
public static T CreateService<T>()
public static T CreateService<T>(string serviceName)

ironruby_sample.rb
----
service = Factory.create_service[ISomeService]

      

=> throws an error "invalid arguments"

By the way, I am using IronRuby 0.5.

0


a source to share


1 answer


Factory.method(:create_service).of(System::String).call(serviceName)

      



You don't need to provide an argument. IronRuby will automatically select the overload. You have to grab the method and then give it (a) the type of the type. Then you pass the arguments to the calling method

+3


a source







All Articles