Udostępnij przez


FileVersionInfo.FileMajorPart Właściwość

Definicja

Pobiera główną część numeru wersji.

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

Wartość właściwości

Wartość reprezentująca główną część numeru wersji lub 0 (zero), jeśli plik nie zawiera informacji o wersji.

Przykłady

Poniższe przykładowe wywołania GetVersionInfo w celu pobrania FileVersionInfo notatnika. Następnie drukuje element FileMajorPart w polu tekstowym. W tym kodzie założono, że textBox1 wystąpienie zostało utworzone.

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

Uwagi

Zazwyczaj numer wersji jest wyświetlany jako "numer główny.numer pomocniczy.numer kompilacji.numer prywatny". Numer wersji pliku to numer 64-bitowy zawierający numer wersji pliku w następujący sposób:

Ta właściwość pobiera pierwszy zestaw 16 bitów.

Dotyczy

Zobacz też