Class Version
Represents the version number of an assembly, operating system, or the common language runtime. This class cannot be inherited.
Inherited Members
Namespace: System
Assembly: mscorlib.dll
Syntax
public sealed class Version
Constructors
| Improve this Doc View SourceVersion(Int32, Int32)
Initializes a new instance of the Version class using the specified major and minor values.
Declaration
public Version(int major, int minor)
Parameters
Type | Name | Description |
---|---|---|
Int32 | major | The major version number. |
Int32 | minor | The minor version number. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
Version(Int32, Int32, Int32, Int32)
Initializes a new instance of the Version class with the specified major, minor, build, and revision numbers.
Declaration
public Version(int major, int minor, int build, int revision)
Parameters
Type | Name | Description |
---|---|---|
Int32 | major | The major version number. |
Int32 | minor | The minor version number. |
Int32 | build | The build number. |
Int32 | revision | The revision number. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
Properties
| Improve this Doc View SourceBuild
Gets the value of the build component of the version number for the current Version object.
Declaration
public int Build { get; }
Property Value
Type | Description |
---|---|
Int32 | The build version number. |
Major
Gets the value of the major component of the version number for the current Version object.
Declaration
public int Major { get; }
Property Value
Type | Description |
---|---|
Int32 | The major version number. |
Minor
Gets the value of the minor component of the version number for the current Version object.
Declaration
public int Minor { get; }
Property Value
Type | Description |
---|---|
Int32 | The minor version number. |
Revision
Gets the value of the revision component of the version number for the current Version object.
Declaration
public int Revision { get; }
Property Value
Type | Description |
---|---|
Int32 | The revision version number. |
Methods
| Improve this Doc View SourceEquals(Object)
Returns a value indicating whether the current Version object is equal to a specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | An object to compare with the current Version object, or null. |
Returns
Type | Description |
---|---|
Boolean | true if the current Version object and obj are both Version objects, and every component of the current Version object matches the corresponding component of obj; otherwise, false. |
Overrides
| Improve this Doc View SourceGetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A 32-bit signed integer hash code. |
Overrides
| Improve this Doc View SourceToString()
Converts the value of the current Version object to its equivalent String representation.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The String representation of the values of the major, minor, build, and revision components of the current 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]] |