mscorlib(4.0.0.0) API with additions
System.Version Class Reference

Represents the version number of an assembly, operating system, or the common language runtime. This class cannot be inherited. More...

Inheritance diagram for System.Version:
[legend]
Collaboration diagram for System.Version:
[legend]

Public Member Functions

 Version (int major, int minor, int build, int revision)
 Initializes a new instance of the T:System.Version class with the specified major, minor, build, and revision numbers. More...
 
 Version (int major, int minor, int build)
 Initializes a new instance of the T:System.Version class using the specified major, minor, and build values. More...
 
 Version (int major, int minor)
 Initializes a new instance of the T:System.Version class using the specified major and minor values. More...
 
 Version (string version)
 Initializes a new instance of the T:System.Version class using the specified string. More...
 
 Version ()
 Initializes a new instance of the T:System.Version class. More...
 
object Clone ()
 Returns a new T:System.Version object whose value is the same as the current T:System.Version object. More...
 
int CompareTo (object version)
 Compares the current T:System.Version object to a specified object and returns an indication of their relative values. More...
 
int CompareTo (Version value)
 Compares the current T:System.Version object to a specified T:System.Version object and returns an indication of their relative values. More...
 
override bool Equals (object obj)
 Returns a value indicating whether the current T:System.Version object is equal to a specified object. More...
 
bool Equals (Version obj)
 Returns a value indicating whether the current T:System.Version object and a specified T:System.Version object represent the same value. More...
 
override int GetHashCode ()
 Returns a hash code for the current T:System.Version object. More...
 
override string ToString ()
 Converts the value of the current T:System.Version object to its equivalent T:System.String representation. More...
 
string ToString (int fieldCount)
 Converts the value of the current T:System.Version object to its equivalent T:System.String representation. A specified count indicates the number of components to return. More...
 
- Public Member Functions inherited from System.IEquatable< Version >
bool Equals (T other)
 Indicates whether the current object is equal to another object of the same type. More...
 

Static Public Member Functions

static Version Parse (string input)
 Converts the string representation of a version number to an equivalent T:System.Version object. More...
 
static bool TryParse (string input, out Version result)
 Tries to convert the string representation of a version number to an equivalent T:System.Version object, and returns a value that indicates whether the conversion succeeded. More...
 
static bool operator== (Version v1, Version v2)
 Determines whether two specified T:System.Version objects are equal. More...
 
static bool operator != (Version v1, Version v2)
 Determines whether two specified T:System.Version objects are not equal. More...
 
static bool operator< (Version v1, Version v2)
 Determines whether the first specified T:System.Version object is less than the second specified T:System.Version object. More...
 
static bool operator<= (Version v1, Version v2)
 Determines whether the first specified T:System.Version object is less than or equal to the second T:System.Version object. More...
 
static bool operator > (Version v1, Version v2)
 Determines whether the first specified T:System.Version object is greater than the second specified T:System.Version object. More...
 
static bool operator >= (Version v1, Version v2)
 Determines whether the first specified T:System.Version object is greater than or equal to the second specified T:System.Version object. More...
 

Properties

int Major [get]
 Gets the value of the major component of the version number for the current T:System.Version object. More...
 
int Minor [get]
 Gets the value of the minor component of the version number for the current T:System.Version object. More...
 
int Build [get]
 Gets the value of the build component of the version number for the current T:System.Version object. More...
 
int Revision [get]
 Gets the value of the revision component of the version number for the current T:System.Version object. More...
 
short MajorRevision [get]
 Gets the high 16 bits of the revision number. More...
 
short MinorRevision [get]
 Gets the low 16 bits of the revision number. More...
 

Detailed Description

Represents the version number of an assembly, operating system, or the common language runtime. This class cannot be inherited.

Definition at line 11 of file Version.cs.

Constructor & Destructor Documentation

◆ Version() [1/5]

System.Version.Version ( int  major,
int  minor,
int  build,
int  revision 
)

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

Parameters
majorThe major version number.
minorThe minor version number.
buildThe build number.
revisionThe revision number.
Exceptions
T:System.ArgumentOutOfRangeExceptionmajor , minor , build , or revision is less than zero.

Definition at line 179 of file Version.cs.

◆ Version() [2/5]

System.Version.Version ( int  major,
int  minor,
int  build 
)

Initializes a new instance of the T:System.Version class using the specified major, minor, and build values.

Parameters
majorThe major version number.
minorThe minor version number.
buildThe build number.
Exceptions
T:System.ArgumentOutOfRangeExceptionmajor , minor , or build is less than zero.

Definition at line 210 of file Version.cs.

◆ Version() [3/5]

System.Version.Version ( int  major,
int  minor 
)

Initializes a new instance of the T:System.Version class using the specified major and minor values.

Parameters
majorThe major version number.
minorThe minor version number.
Exceptions
T:System.ArgumentOutOfRangeExceptionmajor or minor is less than zero.

Definition at line 235 of file Version.cs.

◆ Version() [4/5]

System.Version.Version ( string  version)

Initializes a new instance of the T:System.Version class using the specified string.

Parameters
versionA string containing the major, minor, build, and revision numbers, where each number is delimited with a period character ('.').
Exceptions
T:System.ArgumentExceptionversion has fewer than two components or more than four components.
T:System.ArgumentNullExceptionversion is null.
T:System.ArgumentOutOfRangeExceptionA major, minor, build, or revision component is less than zero.
T:System.FormatExceptionAt least one component of version does not parse to an integer.
T:System.OverflowExceptionAt least one component of version represents a number greater than F:System.Int32.MaxValue.

Definition at line 259 of file Version.cs.

◆ Version() [5/5]

System.Version.Version ( )

Initializes a new instance of the T:System.Version class.

Definition at line 269 of file Version.cs.

Member Function Documentation

◆ Clone()

object System.Version.Clone ( )

Returns a new T:System.Version object whose value is the same as the current T:System.Version object.

Returns
A new T:System.Object whose values are a copy of the current T:System.Version object.

Implements System.ICloneable.

Definition at line 277 of file Version.cs.

◆ CompareTo() [1/2]

int System.Version.CompareTo ( object  version)

Compares the current T:System.Version object to a specified object and returns an indication of their relative values.

Parameters
versionAn object to compare, or null.
Returns
A signed integer that indicates the relative values of the two objects, as shown in the following table.Return value Meaning Less than zero The current T:System.Version object is a version before version . Zero The current T:System.Version object is the same version as version . Greater than zero The current T:System.Version object is a version subsequent to version .-or- version is null.
Exceptions
T:System.ArgumentExceptionversion is not of type T:System.Version.

Definition at line 293 of file Version.cs.

◆ CompareTo() [2/2]

int System.Version.CompareTo ( Version  value)

Compares the current T:System.Version object to a specified T:System.Version object and returns an indication of their relative values.

Parameters
valueA T:System.Version object to compare to the current T:System.Version object, or null.
Returns
A signed integer that indicates the relative values of the two objects, as shown in the following table.Return value Meaning Less than zero The current T:System.Version object is a version before value . Zero The current T:System.Version object is the same version as value . Greater than zero The current T:System.Version object is a version subsequent to value . -or- value is null.

Definition at line 344 of file Version.cs.

◆ Equals() [1/2]

override bool System.Version.Equals ( object  obj)

Returns a value indicating whether the current T:System.Version object is equal to a specified object.

Parameters
objAn object to compare with the current T:System.Version object, or null.
Returns
true if the current T:System.Version object and obj are both T:System.Version objects, and every component of the current T:System.Version object matches the corresponding component of obj ; otherwise, false.

Definition at line 390 of file Version.cs.

◆ Equals() [2/2]

bool System.Version.Equals ( Version  obj)

Returns a value indicating whether the current T:System.Version object and a specified T:System.Version object represent the same value.

Parameters
objA T:System.Version object to compare to the current T:System.Version object, or null.
Returns
true if every component of the current T:System.Version object matches the corresponding component of the obj parameter; otherwise, false.

Definition at line 409 of file Version.cs.

◆ GetHashCode()

override int System.Version.GetHashCode ( )

Returns a hash code for the current T:System.Version object.

Returns
A 32-bit signed integer hash code.

Definition at line 425 of file Version.cs.

◆ operator !=()

static bool System.Version.operator != ( Version  v1,
Version  v2 
)
static

Determines whether two specified T:System.Version objects are not equal.

Parameters
v1The first T:System.Version object.
v2The second T:System.Version object.
Returns
true if v1 does not equal v2 ; otherwise, false.

Definition at line 643 of file Version.cs.

◆ operator >()

static bool System.Version.operator > ( Version  v1,
Version  v2 
)
static

Determines whether the first specified T:System.Version object is greater than the second specified T:System.Version object.

Parameters
v1The first T:System.Version object.
v2The second T:System.Version object.
Returns
true if v1 is greater than v2 ; otherwise, false.

Definition at line 688 of file Version.cs.

◆ operator >=()

static bool System.Version.operator >= ( Version  v1,
Version  v2 
)
static

Determines whether the first specified T:System.Version object is greater than or equal to the second specified T:System.Version object.

Parameters
v1The first T:System.Version object.
v2The second T:System.Version object.
Returns
true if v1 is greater than or equal to v2 ; otherwise, false.

Definition at line 699 of file Version.cs.

◆ operator<()

static bool System.Version.operator< ( Version  v1,
Version  v2 
)
static

Determines whether the first specified T:System.Version object is less than the second specified T:System.Version object.

Parameters
v1The first T:System.Version object.
v2The second T:System.Version object.
Returns
true if v1 is less than v2 ; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionv1 is null.

Definition at line 656 of file Version.cs.

◆ operator<=()

static bool System.Version.operator<= ( Version  v1,
Version  v2 
)
static

Determines whether the first specified T:System.Version object is less than or equal to the second T:System.Version object.

Parameters
v1The first T:System.Version object.
v2The second T:System.Version object.
Returns
true if v1 is less than or equal to v2 ; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionv1 is null.

Definition at line 673 of file Version.cs.

◆ operator==()

static bool System.Version.operator== ( Version  v1,
Version  v2 
)
static

Determines whether two specified T:System.Version objects are equal.

Parameters
v1The first T:System.Version object.
v2The second T:System.Version object.
Returns
true if v1 equals v2 ; otherwise, false.

Definition at line 632 of file Version.cs.

◆ Parse()

static Version System.Version.Parse ( string  input)
static

Converts the string representation of a version number to an equivalent T:System.Version object.

Parameters
inputA string that contains a version number to convert.
Returns
An object that is equivalent to the version number specified in the input parameter.
Exceptions
T:System.ArgumentNullExceptioninput is null.
T:System.ArgumentExceptioninput has fewer than two or more than four version components.
T:System.ArgumentOutOfRangeExceptionAt least one component in input is less than zero.
T:System.FormatExceptionAt least one component in input is not an integer.
T:System.OverflowExceptionAt least one component in input represents a number that is greater than F:System.Int32.MaxValue.

Definition at line 531 of file Version.cs.

◆ ToString() [1/2]

override string System.Version.ToString ( )

Converts the value of the current T:System.Version object to its equivalent T:System.String representation.

Returns
The T:System.String representation of the values of the major, minor, build, and revision components of the current T:System.Version object, as depicted in the following format. Each component is separated by a period character ('.'). Square brackets ('[' and ']') indicate a component that will not appear in the return value if the component is not defined: major.minor[.build[.revision]] For example, if you create a T:System.Version object using the constructor Version(1,1), the returned string is "1.1". If you create a T:System.Version object using the constructor Version(1,3,4,2), the returned string is "1.3.4.2".

Definition at line 437 of file Version.cs.

◆ ToString() [2/2]

string System.Version.ToString ( int  fieldCount)

Converts the value of the current T:System.Version object to its equivalent T:System.String representation. A specified count indicates the number of components to return.

Parameters
fieldCountThe number of components to return. The fieldCount ranges from 0 to 4.
Returns
The T:System.String representation of the values of the major, minor, build, and revision components of the current T:System.Version object, each separated by a period character ('.'). The fieldCount parameter determines how many components are returned.fieldCount Return Value 0 An empty string (""). 1 major 2 major.minor 3 major.minor.build 4 major.minor.build.revision For example, if you create T:System.Version object using the constructor Version(1,3,5), ToString(2) returns "1.3" and ToString(4) throws an exception.
Exceptions
T:System.ArgumentExceptionfieldCount is less than 0, or more than 4.-or- fieldCount is more than the number of components defined in the current T:System.Version object.

Definition at line 457 of file Version.cs.

◆ TryParse()

static bool System.Version.TryParse ( string  input,
out Version  result 
)
static

Tries to convert the string representation of a version number to an equivalent T:System.Version object, and returns a value that indicates whether the conversion succeeded.

Parameters
inputA string that contains a version number to convert.
resultWhen this method returns, contains the T:System.Version equivalent of the number that is contained in input , if the conversion succeeded, or a T:System.Version object whose major and minor version numbers are 0 if the conversion failed. If input is null or F:System.String.Empty, result is null when the method returns.
Returns
true if the input parameter was converted successfully; otherwise, false.

Definition at line 552 of file Version.cs.

Property Documentation

◆ Build

int System.Version.Build
get

Gets the value of the build component of the version number for the current T:System.Version object.

Returns
The build number, or -1 if the build number is undefined.

Definition at line 127 of file Version.cs.

◆ Major

int System.Version.Major
get

Gets the value of the major component of the version number for the current T:System.Version object.

Returns
The major version number.

Definition at line 103 of file Version.cs.

◆ MajorRevision

short System.Version.MajorRevision
get

Gets the high 16 bits of the revision number.

Returns
A 16-bit signed integer.

Definition at line 151 of file Version.cs.

◆ Minor

int System.Version.Minor
get

Gets the value of the minor component of the version number for the current T:System.Version object.

Returns
The minor version number.

Definition at line 115 of file Version.cs.

◆ MinorRevision

short System.Version.MinorRevision
get

Gets the low 16 bits of the revision number.

Returns
A 16-bit signed integer.

Definition at line 163 of file Version.cs.

◆ Revision

int System.Version.Revision
get

Gets the value of the revision component of the version number for the current T:System.Version object.

Returns
The revision number, or -1 if the revision number is undefined.

Definition at line 139 of file Version.cs.


The documentation for this class was generated from the following file: