Share via


Version Constructor (Int32, Int32, Int32, Int32)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes a new instance of the Version class with the specified major, minor, build, and revision numbers.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Sub New ( _
    major As Integer, _
    minor As Integer, _
    build As Integer, _
    revision As Integer _
)
public Version(
    int major,
    int minor,
    int build,
    int revision
)

Parameters

Exceptions

Exception Condition
ArgumentOutOfRangeException

major, minor, build, or revision is less than zero.

Examples

The following example demonstrates the Version constructor and the Major, Minor, Build, and Revision properties.

' This example demonstrates the Version.Revision property.


Class Example
   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      Dim fmtStd As String = "Standard version:" & vbCrLf & _
                             "  major.minor.build.revision = {0}.{1}.{2}.{3}"
      Dim fmtInt As String = "Interim version:" & vbCrLf & _
                             "  major.minor.build.revision = {0}.{1}.{2}.{3}"

      Dim std As New Version(2, 4, 1128, 2)
      Dim interim As New Version(2, 4, 1128, (100 << 16) + 2)

      outputBlock.Text &= String.Format(fmtStd, std.Major, std.Minor, std.Build, std.Revision) & vbCrLf
      outputBlock.Text &= String.Format(fmtInt, interim.Major, interim.Minor, interim.Build, _
                        interim.Revision) & vbCrLf
   End Sub
End Class 

'
'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
'
// 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

*/

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.