Creating objects dynamically

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

I have an application which has included an assembly.

From the application how can I create objects dynamically by passing the
name of the object as string?

Thank you

Regards
Raj
 
Will the potentially needed objects be of unpredictable types and/or a lot
of different potential types?

If not, you could use a switch statement to test for the appropriate string
and instantiate the type accordingly. If not, you'll probably need to do it
via the types in System.Reflection.

-Scott
 
Raj said:
I have an application which has included an assembly.

From the application how can I create objects dynamically by passing the
name of the object as string?

Thank you

Regards
Raj

Activator.CreateInstance() is one possibility.
 
Back
Top