Hi, I need to invoke an overloaded method using reflection. My classes as below:
public static Transformer
{
//Overloaded method with generics parameter. First Transform Method
public static TranformerResult Transform<T>(object [] entities,
List<T> dataContract) where T:class
{
return transformerResult;
}
//Overloaded method without generics parameter. Second Transform Method
public static TranformerResult Transform(object entities,
Type dataContract)
{
return transformerResult;
}
}
public class TransformerResult
{
public List<T> GetTypes<T>() where T:class
{
}
}
I tried to invoke first Transform method with below syntax:
GetMethod(“Transform”,(BindingFlags.Static | BindingFlags.Public),
null, new Type[](){typeof(object[]),typeof(List<Type>}, null)
But I am getting second Transform method.
My intention is to invoke GetType on transformerResult . The transformerResult is an object which returns invocation of first transform method.
Can any one help me to write the C# code to achieve my intention?
Thanks, Mahir