The Activator.CreateInstance
method creates an instance of a specified type using the constructor that best matches the specified parameters.
For example, let's say that you have the type name as a string, and you want to use the string to create an instance of that type. You could use Activator.CreateInstance
for this:
string objTypeName = "Foo";
Foo foo = (Foo)Activator.CreateInstance(Type.GetType(objTypeName));
Here's an MSDN article that explains it's application in more detail: