Share via


FileVersionInfo.ProductMajorPart 属性

定义

获取与此文件关联的产品版本号的主要部分。

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

属性值

表示产品版本号主要部分的值,当文件不包含版本信息时则为 null

示例

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

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

注解

通常,版本号显示为“major number.minor number.build number.private part number”。 产品版本号是保存版本号的 64 位数字,如下所示:

此属性获取第一组 16 位。

适用于

另请参阅