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 create the Interface with (T)Activator.CreateInstance();?
If you want to create a new instance of some type implementing the interface and pass some data you could do something like this:
and call it like this: