Gets a System.CodeDom.Compiler.CodeDomProvider instance for the specified language.
A CodeDOM provider that is implemented for the specified language name.
This method is most commonly used to create an instance of a code provider in an application that may optionally use one of several providers. CodeDomProvider.CreateProvider(string) allows you to specify at run time the code provider you wish to instantiate. If you know at design time which code provider is to be used, you should create an instance of that code provider rather than use the CodeDomProvider.CreateProvider(string) method.
The CodeDomProvider.CreateProvider(string) method returns a System.CodeDom.Compiler.CodeDomProvider instance for a specific language name; it is similar to calling the Activator.CreateInstance(Type, System.Reflection.BindingFlags, System.Reflection.Binder, Object[], System.Globalization.CultureInfo) method with the language provider type. Use CodeDomProvider.CreateProvider(string) when you want to dynamically find a configured provider implementation for a language name.
If more than one provider implementation is configured for the language name, CodeDomProvider.CreateProvider(string) returns a provider instance for the last matching configuration element.
Use the Activator.CreateInstance(Type, System.Reflection.BindingFlags, System.Reflection.Binder, Object[], System.Globalization.CultureInfo) method overload when you want a specific language provider implementation. For example, use the CodeDomProvider.CreateProvider(string) method to get a provider instance that supports the language name "CSharp"; use the Activator.CreateInstance(Type, System.Reflection.BindingFlags, System.Reflection.Binder, Object[], System.Globalization.CultureInfo) method overload to get a provider instance specifically for the Microsoft.CSharp.CSharpCodeProvider implementation. You should use the Activator.CreateInstance(Type, System.Reflection.BindingFlags, System.Reflection.Binder, Object[], System.Globalization.CultureInfo, Object[]) method if you have multiple code providers for a language and you desire to instantiate a specific code provider.
The CodeDomProvider.IsDefinedLanguage(string) method checks whether at least one provider implementation supports a specific language. You can validate a language name using CodeDomProvider.IsDefinedLanguage(string) before passing it to CodeDomProvider.CreateProvider(string). If you pass an unsupported language name to CodeDomProvider.CreateProvider(string) a System.Configuration.ConfigurationException is thrown.
The CodeDomProvider.GetAllCompilerInfo method can be used to determine all System.CodeDom.Compiler.CodeDomProvider implementations on a computer, including additional implementations provided by developers and compiler vendors that are identified in the <system.codedom> in the machine configuration file (Machine.config).
The CodeDomProvider.CreateProvider(string) method returns an instance of a System.CodeDom.Compiler.CodeDomProvider implementation for a specific language.
Language names are case-insensitive.