Dynamically creating an instance from a type name

11/03/2005 - 05:02 por ThisBytes5 | Informe spam
Type codeDomProviderType Type.GetType("Microsoft.CSharp.CSharpCodeProvider", true);


ObjectHandle objHandle = Activator.CreateInstance(null,
"Microsoft.CSharp.CSharpCodeProvider");

Both lines of code throw exceptions when executed, neither one is able
to find the type in question. Am I on the right track? Or should I be
trying to create an instance of the provider a different way.

Example above is hard coded with the CSharpProvider for testing only,
eventually it will be read from a configuration file which one I want
to create.
 

Leer las respuestas

#1 Octavio Hernandez
12/03/2005 - 22:19 | Informe spam
Check out this sample:

http://www.dotnetmania.com/Articulo...vuelo.html

escribió en el mensaje
news:
Type codeDomProviderType > Type.GetType("Microsoft.CSharp.CSharpCodeProvider", true);


ObjectHandle objHandle = Activator.CreateInstance(null,
"Microsoft.CSharp.CSharpCodeProvider");

Both lines of code throw exceptions when executed, neither one is able
to find the type in question. Am I on the right track? Or should I be
trying to create an instance of the provider a different way.

Example above is hard coded with the CSharpProvider for testing only,
eventually it will be read from a configuration file which one I want
to create.

Preguntas similares