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.

Preguntas similare

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.

email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida