Returns a language name associated with the specified file name extension, as configured in the CodeDomProvider compiler configuration section.
Assembly: System (in System.dll)
[<ComVisibleAttribute(false)>] static member GetLanguageFromExtension : extension:string -> string
- Type: System.String
A file name extension.
The <system.codedom> Element in the machine configuration file (Machine.config) contains the language provider and compiler configuration settings for each CodeDomProvider implementation on the computer. The method searches each provider configuration element for the specified file name extension.
The IsDefinedExtension method checks whether at least one provider implementation supports a specific file name extension. You can validate a file name extension using IsDefinedExtension before passing it to . This prevents from throwing a System.Configuration.ConfigurationException for an unsupported file name extension.
If a provider implementation supports the input file name extension, and there are multiple supported languages configured for that provider, then returns the first language name for that provider. If more than one provider implementation is configured for the input file name extension, returns the language name from the last matching provider configuration element.
Language names and file name extensions are case-insensitive.
The following code example determines the CodeDomProvider implementation for an input file name extension and displays the configured settings for the language provider. This code example is part of a larger example provided for the CompilerInfo class.
for full trust for the immediate caller. This member cannot be used by partially trusted code.