Class Revision
Represents a revision number that is expressed by as {Major}.{Minor}.
public sealed class Revision : IComparable
- Inheritance
-
Revision
- Implements
- Inherited Members
Constructors
Revision()
Creates a new default Revision with value 1.0.
public Revision()
Revision(double)
Creates a new Revision with the specified value.
public Revision(double value)
Parameters
value
doubleThe double value representing the revision number.
Revision(string)
public Revision(string value)
Parameters
value
string
Revision(ushort, ushort)
Creates a new Revision with the specified major and minor values.
public Revision(ushort major, ushort minor = 0)
Parameters
major
ushortThe value of the major revision.
minor
ushortThe value of the minor revision. Will default to 0 if not provided.
Properties
Major
The major revision of the Revision value.
public string Major { get; }
Property Value
Minor
The minor revision of the Revision value.
public string Minor { get; }
Property Value
Methods
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
obj
objectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
ValueMeaning
Less than zero
This instance precedes
obj
in the sort order.Zero
This instance occurs in the same position in the sort order as
obj
.Greater than zero
This instance follows
obj
in the sort order.
Exceptions
- ArgumentException
obj
is not the same type as this instance.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator ==(Revision, Revision)
Determines if the provided objects are equal.
public static bool operator ==(Revision left, Revision right)
Parameters
Returns
- bool
true if the provided objects are equal; otherwise, false.
operator >(Revision, Revision)
Compares two objects and determines if left is greater than right.
public static bool operator >(Revision left, Revision right)
Parameters
Returns
- bool
true
ifleft
is greater thanright
, otherwise,false
.
operator >=(Revision, Revision)
Compares two objects and determines if left is greater than or equal to right.
public static bool operator >=(Revision left, Revision right)
Parameters
Returns
- bool
true
ifleft
is greater than or equal toright
, otherwise,false
.
implicit operator string(Revision)
public static implicit operator string(Revision revision)
Parameters
revision
RevisionThe revision value to convert.
Returns
implicit operator Revision(double)
public static implicit operator Revision(double revision)
Parameters
revision
doubleThe revision value to convert.
Returns
implicit operator Revision(string)
public static implicit operator Revision(string revision)
Parameters
revision
stringThe revision value to convert.
Returns
operator !=(Revision, Revision)
Determines if the provided objects are not equal.
public static bool operator !=(Revision left, Revision right)
Parameters
Returns
- bool
true if the provided objects are not equal; otherwise, false.
operator <(Revision, Revision)
Compares two objects and determines if left is less than right.
public static bool operator <(Revision left, Revision right)
Parameters
Returns
- bool
true
ifleft
is less thanright
, otherwise,false
.
operator <=(Revision, Revision)
Compares two objects and determines if left is less than or equal to right.
public static bool operator <=(Revision left, Revision right)
Parameters
Returns
- bool
true
ifleft
is less or equal to thanright
, otherwise,false
.