BuildProvider.GetDefaultCompilerTypeForLanguage(String) 方法
定义
根据指定的语言返回生成提供程序的编译器设置。Returns the compiler settings for the build provider based on the specified language.
protected:
System::Web::Compilation::CompilerType ^ GetDefaultCompilerTypeForLanguage(System::String ^ language);
protected System.Web.Compilation.CompilerType GetDefaultCompilerTypeForLanguage (string language);
member this.GetDefaultCompilerTypeForLanguage : string -> System.Web.Compilation.CompilerType
Protected Function GetDefaultCompilerTypeForLanguage (language As String) As CompilerType
参数
- language
- String
代码语言名称。A code language name.
返回
CompilerType,根据指定的语言表示生成提供程序的编译器设置。A CompilerType that represents the compiler settings for the build provider based on the specified language. 基类根据应用程序配置文件返回该语言的默认编译器设置。The base class returns the default compiler settings for the language based on the application configuration file.
例外
language 为 null。language is null.
language 与生成提供程序的已配置编译器不匹配。language does not match a configured compiler for the build provider.
注解
使用 GetDefaultCompilerTypeForLanguage 方法检查在生成提供程序中为特定语言名称配置的编译器类型。Use the GetDefaultCompilerTypeForLanguage method to examine the compiler type configured in the build provider for a specific language name. 使用 GetDefaultCompilerType 方法检查生成提供程序的默认编译器类型。Use the GetDefaultCompilerType method to examine the default compiler type for a build provider.
基类 BuildProvider 使用 Compiler 配置文件的对象的属性中的元素来确定默认编译器类型 Compilers CompilationSection 。The base BuildProvider class determines the default compiler type using the Compiler elements in the Compilers property of the CompilationSection object for the configuration file. 这等效于检查和配置文件部分中的元素。This is equivalent to examining the elements in the and the elements in the sections of the configuration file. 例如,对于 language 值 VB,基类方法返回一个 CompilerType 与实例的配置设置相对应的对象 Microsoft.VisualBasic.VBCodeProvider 。For example, for the language value VB, the base class method returns a CompilerType object that corresponds to the configured settings for an instance of Microsoft.VisualBasic.VBCodeProvider.
从类派生时 BuildProvider ,可以使用 GetDefaultCompilerTypeForLanguage 为 CodeCompilerType 实现支持的语言设置属性值。When you derive from the BuildProvider class, you can use GetDefaultCompilerTypeForLanguage to set the CodeCompilerType property value for the language supported by your implementation.