FileVersionInfo.ProductName 属性

定义

获取与此文件一起发行的产品的名称。Gets the name of the product this file is distributed with.

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

属性值

String

与此文件一起发行的产品的名称,当文件不包含版本信息则为 nullThe name of the product this file is distributed with or null if the file did not contain version information.

示例

下面的示例调用 GetVersionInfo 以获取 FileVersionInfo 记事本的。The following example calls GetVersionInfo to get the FileVersionInfo for the Notepad. 然后,它将打印 ProductName 在文本框中。Then it prints the ProductName in a text box. 此代码假定 textBox1 已实例化。This code assumes textBox1 has been instantiated.

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

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

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

适用于