I have a method in third party component which can be invoked like the below code:
ICustomer log = Axis.GetInstance<ICustomer>();
Since i do not want to expose the above third party component directly to all the callers, i decided to create a wrapper method which calls the third party “Axis.GetInstance()”, My problem is how to pass the type T and invoke the method inside the generic method
calling code:
var result = Util.MyCustomWrapper<ICustomer>();
public class Util
{
public static T MyCustomWrapper<T>()
{
1.call Axis.GetInstance<T>(); // **how to pass the type T**
2.return T
}
}
The method can called just as you have written it: