共用方式為


FileVersionInfo.FileName 屬性

定義

取得這個 FileVersionInfo 的執行個體所描述的檔案名稱。

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

屬性值

這個 FileVersionInfo 的執行個體所描述的檔案名稱。

範例

下列範例會呼叫 GetVersionInfo 以取得 FileVersionInfo [記事本] 的 。 然後它會在文字框中列印 FileName 。 此程式代碼假設 textBox1 已具現化。

private:
    void GetFileName()
    {
        // Get the file version for the notepad.
        FileVersionInfo^ myFileVersionInfo =
            FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" );

        // Print the file name.
        textBox1->Text = String::Concat( "File name: ", myFileVersionInfo->FileName );
    }
private void GetFileName()
{
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo =
        FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe");

    // Print the file name.
    textBox1.Text = "File name: " + myFileVersionInfo.FileName;
}
Private Sub GetFileName()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe")
    
    ' Print the file name.
    textBox1.Text = "File name: " & myFileVersionInfo.FileName
End Sub

適用於