FileVersionInfo.FileMajorPart Property

Gets the major part of the version number.

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

public int FileMajorPart { get; }
/** @property */
public int get_FileMajorPart ()

public function get FileMajorPart () : int

Property Value

A value representing the major part of the version number.

Typically, a version number is displayed as "major number.minor number.build number.private part number". A file version number is a 64-bit number that holds the version number for a file as follows:

This property gets the first set of 16 bits.

The following example calls GetVersionInfo to get the FileVersionInfo for the Notepad. Then it prints the FileMajorPart in a text box. This code assumes textBox1 has been instantiated.

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 void GetFileMajorPart()
{
    // Get the file version for the notepad.
    FileVersionInfo myFileVersionInfo = 
        FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");

    // Print the file major part number.
    textBox1.set_Text("File major part number: " 
        + myFileVersionInfo.get_FileMajorPart());
} //GetFileMajorPart

private function GetFileMajorPart() {
    //Get the file version for the notepad.
    var myFileVersionInfo : FileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
 
    //Print the file major part number.
    textBox1.Text = "File major part number: " + myFileVersionInfo.FileMajorPart;
 }
    

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: