Is there a general way of instantiating an instance of a
class using Reflection?

instantiate an object using reflection by RH

RH
Thu Jan 08 14:39:09 CST 2004

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

>-----Original Message-----
>
>Is there a general way of instantiating an instance of a
>class using Reflection?
>
>
>.
>

instantiate an object using reflection by anonymous

anonymous
Thu Jan 08 15:58:08 CST 2004


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?


>-----Original Message-----
>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
>
>>-----Original Message-----
>>
>>Is there a general way of instantiating an instance of a
>>class using Reflection?
>>
>>
>>.
>>
>.
>