共用方式為


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)

備註

這個屬性是由程式代碼產生器和程式代碼編譯程式使用,以指出應該產生或使用哪些擴展名。

適用於