Version Constructor (Int32, Int32, Int32, Int32)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Initializes a new instance of the Version class with the specified major, minor, build, and revision numbers.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- major
- Type: System.Int32
The major version number.
- minor
- Type: System.Int32
The minor version number.
- build
- Type: System.Int32
The build number.
- revision
- Type: System.Int32
The revision number.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | major, minor, build, or revision is less than zero. |
The following example demonstrates the Version constructor and the Major, Minor, Build, and Revision properties.
// This example demonstrates the Version.Revision, // MajorRevision, and MinorRevision properties. using System; class Example { public static void Demo(System.Windows.Controls.TextBlock outputBlock) { string fmtStd = "Standard version:\n" + " major.minor.build.revision = {0}.{1}.{2}.{3}"; string fmtInt = "Interim version:\n" + " major.minor.build.revision = {0}.{1}.{2}.{3}"; Version std = new Version(2, 4, 1128, 2); Version interim = new Version(2, 4, 1128, (100 << 16) + 2); outputBlock.Text += String.Format(fmtStd, std.Major, std.Minor, std.Build, std.Revision) + "\n"; outputBlock.Text += String.Format(fmtInt, interim.Major, interim.Minor, interim.Build, interim.Revision) + "\n"; } } /* This code example produces the following results: Standard version: major.minor.build.revision = 2.4.1128.2 Interim version: major.minor.build.majRev/minRev = 2.4.1128.100/2 */
Show: