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

注解

此属性使应用程序能够确定文件是否已重命名。

适用于