Share via


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 = String::Concat( "File major part number: ", myFileVersionInfo->FileMajorPart );
   }
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

備註

一般而言,版本號碼會顯示為「major number.minor number.build number.private part number」。 檔案版本號碼是64位號碼,保存檔案的版本號碼,如下所示:

這個屬性會取得第一組 16 位。

適用於

另請參閱