CodeDomProvider.FileExtension 属性

定义

获取用于当前语言的源代码文件的默认文件扩展名。

public:
 virtual property System::String ^ FileExtension { System::String ^ get(); };
public virtual string FileExtension { get; }
member this.FileExtension : string
Public Overridable ReadOnly Property FileExtension As String

属性值

与当前语言的源文件扩展名相对应的文件扩展名。 此基实现总是返回 Empty

示例

下面的代码示例创建 的 Microsoft.VisualBasic.VBCodeProvider实例。 该示例显示新提供程序实例的提供程序名称、哈希代码和默认文件扩展名。

         // Get the provider for Microsoft.VisualBasic
//         CodeDomProvider^ provider = CodeDomProvider.CreateProvider("VisualBasic");
         CodeDomProvider^ provider = CodeDomProvider::CreateProvider("VisualBasic");
         if ( provider ) // Display the Visual Basic language provider information.
         {
            Console::WriteLine( "Visual Basic provider is {0}", provider->ToString() );
            Console::WriteLine( "  Provider hash code:     {0}", provider->GetHashCode().ToString() );
            Console::WriteLine( "  Default file extension: {0}", provider->FileExtension );
         }
// Get the provider for Microsoft.VisualBasic
CodeDomProvider provider = CodeDomProvider.CreateProvider("VisualBasic");

// Display the Visual Basic language provider information.
Console.WriteLine("Visual Basic provider is {0}",
    provider.ToString());
Console.WriteLine("  Provider hash code:     {0}",
    provider.GetHashCode().ToString());
Console.WriteLine("  Default file extension: {0}",
    provider.FileExtension);
' Get the provider for Microsoft.VisualBasic
   Dim provider = CodeDomProvider.CreateProvider("VisualBasic")

' Display the Visual Basic language provider information.
Console.WriteLine("Visual Basic provider is {0}", _
   provider.ToString())
Console.WriteLine("  Provider hash code:     {0}", _
   provider.GetHashCode().ToString())
Console.WriteLine("  Default file extension: {0}", _
   provider.FileExtension)

注解

代码生成器和代码编译器使用此属性来指示应生成或使用哪些文件扩展名。

适用于