Class HarpVersion
Represents the major and minor version of Harp firmware or hardware.
public sealed class HarpVersion : IComparable, IComparable<HarpVersion>, IEquatable<HarpVersion>
- Inheritance
-
HarpVersion
- Implements
- Inherited Members
Constructors
HarpVersion(int?, int?)
Initializes a new instance of the HarpVersion class with the specified major and minor version.
public HarpVersion(int? major, int? minor)
Parameters
major
int?The optional major version. If not specified, matches against all versions.
minor
int?The optional minor version. If not specified, matches against all minor versions with the same major version.
Properties
Major
Gets the optional major version.
public int? Major { get; }
Property Value
- int?
Minor
Gets the optional minor version.
public int? Minor { get; }
Property Value
- int?
Methods
CompareTo(HarpVersion)
Performs a comparison with another version object and returns a value indicating whether this version is less than, equal, or greater than the other.
public int CompareTo(HarpVersion other)
Parameters
other
HarpVersionThe version object to compare with.
Returns
- int
A negative number if this version is lower than the other version; zero if it is the same version; a positive number if this version is higher than the other version. Floating wildcards are always smaller for the purposes of ordering.
Equals(HarpVersion)
Determines whether the specified version is equal to the current version.
public bool Equals(HarpVersion other)
Parameters
other
HarpVersionThe version object to compare with the current version.
Returns
- bool
true if the specified version object is equal to the current version; otherwise, false.
Equals(object)
Determines whether the specified object is equal to the current version.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current version.
Returns
- bool
true if the specified object is equal to the current version; otherwise, false.
GetHashCode()
Computes the hash code for the current version object.
public override int GetHashCode()
Returns
- int
The hash code for the current version object, extracted from a combination of the major and minor version hashes.
Parse(string)
Converts a string representation of a HarpVersion to its equivalent value.
public static HarpVersion Parse(string version)
Parameters
version
stringThe string representing a HarpVersion.
Returns
- HarpVersion
The equivalent HarpVersion object for the specified string representation.
Satisfies(HarpVersion)
Returns whether the specified version matches the current version, taking into account compatible floating ranges.
public bool Satisfies(HarpVersion other)
Parameters
other
HarpVersionThe HarpVersion with which to compare.
Returns
- bool
true if
other
matches against the current version; otherwise, false.
ToString()
Converts the HarpVersion object to its equivalent string representation.
public override string ToString()
Returns
- string
The string representation of the HarpVersion object.
TryParse(string, out HarpVersion)
Converts a string representation of a HarpVersion to its equivalent value. A return value indicates whether the conversion succeeded.
public static bool TryParse(string version, out HarpVersion value)
Parameters
version
stringThe string representing a HarpVersion.
value
HarpVersionWhen this method returns, contains the equivalent HarpVersion object for the specified string representation if the conversion was successful; otherwise, contains null.
Returns
- bool
true if the conversion was successful; otherwise, false.
Operators
operator ==(HarpVersion, HarpVersion)
Determines whether the values on both sides of the equality operator are equal.
public static bool operator ==(HarpVersion lhs, HarpVersion rhs)
Parameters
lhs
HarpVersionThe value on the left-hand side of the operator.
rhs
HarpVersionThe value on the right-hand side of the operator.
Returns
- bool
true if the value on the left-hand side of the operator is equal to the value on the right-hand side; otherwise, false.
operator >(HarpVersion, HarpVersion)
Determines whether the value on the left-hand side of the operator is greater than the value on the right-hand side.
public static bool operator >(HarpVersion lhs, HarpVersion rhs)
Parameters
lhs
HarpVersionThe value on the left-hand side of the operator.
rhs
HarpVersionThe value on the right-hand side of the operator.
Returns
- bool
true if the value on the left-hand side of the operator is greater than the value on the right-hand side; otherwise, false.
operator >=(HarpVersion, HarpVersion)
Determines whether the value on the left-hand side of the operator is greater than or equal to the value on the right-hand side.
public static bool operator >=(HarpVersion lhs, HarpVersion rhs)
Parameters
lhs
HarpVersionThe value on the left-hand side of the operator.
rhs
HarpVersionThe value on the right-hand side of the operator.
Returns
- bool
true if the value on the left-hand side of the operator is greater than or equal to the value on the right-hand side; otherwise, false.
operator !=(HarpVersion, HarpVersion)
Determines whether the values on both sides of the inequality operator are not equal.
public static bool operator !=(HarpVersion lhs, HarpVersion rhs)
Parameters
lhs
HarpVersionThe value on the left-hand side of the operator.
rhs
HarpVersionThe value on the right-hand side of the operator.
Returns
- bool
true if the value on the left-hand side of the operator is not equal to the value on the right-hand side; otherwise, false.
operator <(HarpVersion, HarpVersion)
Determines whether the value on the left-hand side of the operator is less than the value on the right-hand side.
public static bool operator <(HarpVersion lhs, HarpVersion rhs)
Parameters
lhs
HarpVersionThe value on the left-hand side of the operator.
rhs
HarpVersionThe value on the right-hand side of the operator.
Returns
- bool
true if the value on the left-hand side of the operator is less than the value on the right-hand side; otherwise, false.
operator <=(HarpVersion, HarpVersion)
Determines whether the value on the left-hand side of the operator is less than or equal to the value on the right-hand side.
public static bool operator <=(HarpVersion lhs, HarpVersion rhs)
Parameters
lhs
HarpVersionThe value on the left-hand side of the operator.
rhs
HarpVersionThe value on the right-hand side of the operator.
Returns
- bool
true if the value on the left-hand side of the operator is less than or equal to the value on the right-hand side; otherwise, false.