How do I call SomeObject.SomeGenericInstanceMethod<T>(T arg)
?
There are a few posts about calling generic methods, but not quite like this one. The problem is that the method argument parameter is constrained to the generic parameter.
I know that if the signature were instead
SomeObject.SomeGenericInstanceMethod<T>(string arg)
then I could get the MethodInfo with
typeof (SomeObject).GetMethod("SomeGenericInstanceMethod", new Type[]{typeof (string)}).MakeGenericMethod(typeof(GenericParameter))
So, How do I go about getting the MethodInfo when the regular arguments are of a generic type? Thanks!
Also, there may or may not be type constrains on the generic parameter.