instantiate an object using reflection

  • Thread starter Thread starter Big
  • Start date Start date
Here is how I am doing it (C#):

System.Type objectType;
System.Object obj;
objectType = System.Type.GetType("Class Name Here");
/* note: if you don't qualify the class name properly
you get an undefined type here. */
obj = Activator.CreateInstance(objectType);

Hope this helps out.

RH
 
What is the difference between using the Activator class
and using AppDomain.CreateInstance method? The only
difference I can see is that the Activator class allows
you to create remote objects.

Are there any other differences?
 
Back
Top