[Serializable] |
The format of the version number is as follows. Optional components are shown in square brackets ('[' and ']'):
major.minor[.build[.revision]]
The components are used by convention as follows:
Subsequent versions of an assembly that differ only by build or revision numbers are considered to be Quick Fix Engineering (QFE) updates of the prior version. If necessary, the build and revision numbers can be honored by changing the version policy in the configuration.
This class implements the ICloneable and IComparable interfaces.
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the Version class. |
ctor #2 | Overloaded:.ctor(string version) Initializes a new instance of the Version class using the value represented by the specified String. |
ctor #3 | Overloaded:.ctor(int major, int minor) Initializes a new instance of the Version class using the specified major and minor values. |
ctor #4 | Overloaded:.ctor(int major, int minor, int build) Initializes a new instance of the Version class using the specified major, minor, and build values. |
ctor #5 | Overloaded:.ctor(int major, int minor, int build, int revision) Initializes a new instance of the Version class with the specified major, minor, build, and revision numbers. |
Build | Read-only Gets the value of the build component of the version number for this instance. |
Major | Read-only Gets the value of the major component of the version number for this instance. |
Minor | Read-only Gets the value of the minor component of the version number for this instance. |
Revision | Read-only Gets the value of the revision component of the version number for this instance. |
Clone | Returns a new Version whose value is the same as this instance. |
CompareTo | Compares this instance to a specified object and returns an indication of their relative values. |
Equals | Overridden: Returns a value indicating whether this instance is equal to a specified object. |
GetHashCode | Overridden: Returns a hash code for this instance. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString | Overloaded:ToString() Overridden: Converts the value of this instance to its equivalent String representation. |
ToString | Overloaded:ToString(int fieldCount) Converts the value of this instance to its equivalent String representation. A specified count indicates the number of components to return. |
op_Equality | Determines whether two specified instances of Version are equal. |
op_GreaterThan | Determines whether the first specified instance of Version is greater than the second specified instance of Version. |
op_GreaterThanOrEqual | Determines whether the first specified instance of Version is greater than or equal to the second instance of Version. |
op_Inequality | Determines whether two specified instances of Version are not equal. |
op_LessThan | Determines whether the first specified instance of Version is less than the second specified instance of Version. |
op_LessThanOrEqual | Determines whether the first specified instance of Version is less than or equal to the second instance of Version. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public Version(); |
public Version( |
version
Exception Type | Condition |
---|---|
ArgumentException | version has fewer than two components or more than four components. -or- At least one component of version does not parse to a decimal integer. |
ArgumentNullException | version is null. |
ArgumentOutOfRangeException | A major, minor, build, or revision component is less than zero. |
The format of the version number is as follows. Optional components are shown in square brackets ('[' and ']'):
major.minor[.build[.revision]]
All defined components must be decimal integers greater than 0. Metadata restricts the value of each major, minor, build, and revision component to a maximum value of UInt16.MaxValue - 1.
For example, if the major number is 6, the minor number is 2, the build number is 1, and the revision number is 3, then version should be "6.2.1.3".
major
minor
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | major or minor is less than zero. |
major
minor
build
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | major, minor, or build are less than zero. |
major
minor
build
revision
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | major, minor, build, or revision are less than zero. |
public int Build {get;}
|
public int Major {get;}
|
public int Minor {get;}
|
public int Revision {get;}
|
public object Clone(); |
version
Return Value | Description |
---|---|
Less than zero | This instance is before . |
Zero | This instance is the same as . |
Greater than zero | This instance is subsequent to version. |
Exception Type | Condition |
---|---|
ArgumentNullException | version is null. |
ArgumentException | version is not of type Version. |
For example:
obj
~Version(); |
public override int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
v1
v2
v1
v2
v1
v2
v1
v2
v1
v2
v1
v2
public override string ToString(); |
major.minor[.build[.revision]]
For example, if you create an instance of Version using the constructor
Version(1,1)
, the returned string is "1.1". If you create an instance of Version using the constructor
Version(1,3,4,2)
, the returned string is "1.3.4.2".
fieldCount
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 an instance of Version using the constructor
Version(1,3,5)
,
ToString(2)
returns "1.3" and
ToString(4)
throws an exception.
Exception Type | Condition |
---|---|
ArgumentException | fieldCount is less than 0, or more than 4. -or- fieldCount is more than the number of components defined in this instance. |