FileVersionInfo.ProductName 属性

定义

获取此文件分发的产品的名称。

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

属性值

此文件分发的产品的名称,或者 null 该文件不包含版本信息。

示例

以下示例调用 GetVersionInfo 获取 FileVersionInfo 记事本。 然后,它将打印 ProductName 在文本框中。 此代码假定 textBox1 已实例化。

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

适用于