Create an instance of a class from a string

PeteT picture PeteT · Oct 22, 2008 · Viewed 274.8k times · Source

Is there a way to create an instance of a class based on the fact I know the name of the class at runtime. Basically I would have the name of the class in a string.

Answer

Matt Hamilton picture Matt Hamilton · Oct 22, 2008

Take a look at the Activator.CreateInstance method.