FileVersionInfo.ProductName 属性

获取与此文件一起发行的产品的名称。

**命名空间:**System.Diagnostics
**程序集:**System(在 system.dll 中)

语法

声明
Public ReadOnly Property ProductName As String
用法
Dim instance As FileVersionInfo
Dim value As String

value = instance.ProductName
public string ProductName { get; }
public:
property String^ ProductName {
    String^ get ();
}
/** @property */
public String get_ProductName ()
public function get ProductName () : String

属性值

与此文件一起发行的产品的名称。

示例

下面的示例调用 GetVersionInfo 来获取“记事本”(Notepad) 的 FileVersionInfo。然后,它在文本框内输出 ProductName。这段代码假定已经实例化 textBox1

Private Sub GetProductName()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
    
    ' Print the product name.
    textBox1.Text = "Product name: " & myFileVersionInfo.ProductName
End Sub 'GetProductName
private void GetProductName() {
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    // Print the product name.
    textBox1.Text = "Product name: " + myFileVersionInfo.ProductName;
 }
    
private:
   void GetProductName()
   {
      // Get the file version for the notepad.
      FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo( "%systemroot%\\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("%systemroot%\\Notepad.exe");

    // Print the product name.
    textBox1.set_Text("Product name: " 
        + myFileVersionInfo.get_ProductName());
} //GetProductName
private function GetProductName() {
    //Get the file version for the notepad.
    var myFileVersionInfo : FileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    //Print the product name.
    textBox1.Text = "Product name: " + myFileVersionInfo.ProductName;
 }
    

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

FileVersionInfo 类
FileVersionInfo 成员
System.Diagnostics 命名空间