語言

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 = "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

備註

通常,版本號會顯示為「主要號.次要號.製造號.私人零件號」。 產品版本號是一種 64 位元的編號,其版本號如下:

此性質獲得第一組 16 位元。

適用於

另請參閱