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

适用于