I have 12 classes in my project like this:
class class1
{
}
class class2
{
}
in another class I have a method that I want to create an instance of class1
or class2
according to a string:
public void MyMethod(string s)
{
//I want to create an instance of class1 if s=="class1" or class2 if s=="class2"
}
How I can do this?