Use string value to create new instance
- by Brian David Berman
I have a few classes: SomeClass1, SomeClass2.
How can I create a new instance of one of these classes by using the class name from a string?
Normally, I would do:
var someClass1 = new SomeClass1();
How can I create this instance from the following:
var className = "SomeClass1";
I am assuming I should use Type.GetType() or something but I can't figure it out.
Thanks.