instantiate type c#

71

instantiate type c# -

// determine type here
var type = typeof(MyClass);

// create an object of the type
var obj = (MyClass)Activator.CreateInstance(type);

Comments

Submit
0 Comments