Freigeben über


FileVersionInfo.ProductMajorPart-Eigenschaft

Ruft den Hauptteil der Versionsnummer des Produkts ab, dem diese Datei zugeordnet ist.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

Syntax

'Declaration
Public ReadOnly Property ProductMajorPart As Integer
'Usage
Dim instance As FileVersionInfo
Dim value As Integer

value = instance.ProductMajorPart
public int ProductMajorPart { get; }
public:
property int ProductMajorPart {
    int get ();
}
/** @property */
public int get_ProductMajorPart ()
public function get ProductMajorPart () : int

Eigenschaftenwert

Ein Wert, der den Hauptteil der Produktversionsnummer darstellt.

Hinweise

Eine Versionsnummer wird üblicherweise als "Hauptversionsnummer.Nebenversionsnummer.Buildnummer.Einzelteilnummer" angezeigt. Eine Produktversionsnummer ist eine 64-Bit-Zahl, die die Versionsnummer wie folgt enthält:

Diese Eigenschaft ruft die erste 16-Bit-Gruppe ab.

Beispiel

Im folgenden Beispiel wird GetVersionInfo aufgerufen, um FileVersionInfo für den Editor abzurufen. ProductMajorPart wird dann in einem Textfeld angezeigt. Bei diesem Code wird davon ausgegangen, dass textBox1 instanziiert wurde.

Private Sub GetProductMajorPart()
    ' Get the file version for the notepad.
    Dim myFileVersionInfo As FileVersionInfo = _
        FileVersionInfo.GetVersionInfo("%systemroot%\Notepad.exe")
    
    ' Print the product major part number.
    textBox1.Text = "Product major part number: " & myFileVersionInfo.ProductMajorPart
End Sub 'GetProductMajorPart
private void GetProductMajorPart() {
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    // Print the product major part number.
    textBox1.Text = "Product major part number: " + myFileVersionInfo.ProductMajorPart;
 }
    
private:
   void GetProductMajorPart()
   {
      // Get the file version for the notepad.
      FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo( "%systemroot%\\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("%systemroot%\\Notepad.exe");

    // Print the product major part number.
    textBox1.set_Text("Product major part number: " 
        + myFileVersionInfo.get_ProductMajorPart());
} //GetProductMajorPart
private function GetProductMajorPart() {
    //Get the file version for the notepad.
    var myFileVersionInfo : FileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    //Print the product major part number.
    textBox1.Text = "Product major part number: " + myFileVersionInfo.ProductMajorPart;
 }
    

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

FileVersionInfo-Klasse
FileVersionInfo-Member
System.Diagnostics-Namespace
FileVersionInfo.ProductBuildPart-Eigenschaft
ProductMinorPart
ProductVersion