What is the diffrenece between the two examples below? What is the purpose of Activator
, why would I use it?
1.
string objTypeName = "Foo";
Foo foo = (Foo)Activator.CreateInstance(Type.GetType(objTypeName));
2.
Foo foo = new Foo()
I went through below the pages linked below, but didn't get a clear picture.