I have a class name as a string. I can then use the following to create a new instance
var assemblyName = Assembly.GetExecutingAssemble().FullName;
var myObj = Activator.CreateInstance(assName, myClassName);
My issue is that I have the following generic method declaration
public static async Task myMethod<T>(string id) where T:IIdentity //boxing
I cannot call this method via
myMethod<myObj>("hello");
as myObj isn't of type T.
Is there a way that I can create a valid instance of myClassName that can be passed to my generic method?