Język

FileVersionInfo.ProductMajorPart Właściwość

Definicja

Pobiera główną część numeru wersji produktu, z tym plikiem jest skojarzony.

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

Wartość właściwości

Wartość reprezentująca główną część numeru wersji produktu lub null jeśli plik nie zawiera informacji o wersji.

Przykłady

Poniższe przykładowe wywołania GetVersionInfo , aby pobrać FileVersionInfo element dla Notatnika. Następnie drukuje element ProductMajorPart w polu tekstowym. Ten kod zakłada, że textBox1 wystąpienie zostało utworzone.

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

Uwagi

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

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

Dotyczy

Zobacz też