語言

FileVersionInfo.FileMajorPart 屬性

定義

它會取得版本號的主要部分。

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

屬性值

代表版本號大部分的值,若檔案不包含版本資訊則為 0(零)。

範例

以下範例要求 GetVersionInfo 取得 FileVersionInfo 記事本。 接著它會把 印 FileMajorPart 在文字框裡。 此程式碼假設 textBox1 已被實例化。

private void GetFileMajorPart() {
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");

    // Print the file major part number.
    textBox1.Text = "File major part number: " + myFileVersionInfo.FileMajorPart;
 }
Private Sub GetFileMajorPart()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
    
    ' Print the file major part number.
    textBox1.Text = "File major part number: " & myFileVersionInfo.FileMajorPart
End Sub

備註

通常,版本號會顯示為「主要號.次要號.製造號.私人零件號」。 檔案版本號是一種 64 位元的數字,用來表示檔案的版本號如下:

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

適用於

另請參閱