I classes called classA,ClassB,ClassC. There is a string called className which holds the name of the class.. Instead of using bunch of If else statements, Is there any method to create new class like
new className()
I classes called classA,ClassB,ClassC. There is a string called className which holds the name of the class.. Instead of using bunch of If else statements, Is there any method to create new class like
new className()
You can use Activator class for the same
eg.
Activator.CreateInstance<className>();
or
Activator.CreateInstance(typeof(className));