共用方式為


FileVersionInfo.OriginalFilename 屬性

定義

取得建立檔案所使用的名稱。

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

屬性值

建立檔案所使用的名稱,如果檔案未包含版本資訊,則為 null

範例

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

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

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

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

備註

這個屬性可讓應用程式判斷檔案是否已重新命名。

適用於