FileVersionInfo.ProductMajorPart 属性

定义

获取与此文件关联的产品版本号的主要部分。Gets the major part of the version number for the product this file is associated with.

public:
 property int ProductMajorPart { int get(); };
public int ProductMajorPart { get; }
member this.ProductMajorPart : int
Public ReadOnly Property ProductMajorPart As Integer

属性值

Int32

表示产品版本号主要部分的值,当文件不包含版本信息时则为 nullA value representing the major part of the product version number or null if the file did not contain version information.

示例

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

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

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

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

注解

通常,版本号显示为 "主编号. 次要版本号. 内部版本号. 内部版本号. 专用号"。Typically, a version number is displayed as "major number.minor number.build number.private part number". 产品版本号是一个64位的数字,它保存版本号,如下所示:A product version number is a 64-bit number that holds the version number as follows:

此属性获取第一组16位。This property gets the first set of 16 bits.

适用于

另请参阅