Can I Create A Generic Method of a Type of Interface?
- by DaveDev
Is it possible to create a generic method with a signature like
public static string MyMethod<IMyTypeOfInterface>(object dataToPassToInterface)
{
// an instance of IMyTypeOfInterface knows how to handle
// the data that is passed in
}
Would I have to instantiate the Interface with (T)Activator.CreateInstance();?