Class SemVer
The SemVer class holds the semantic version for an Ethos resource. Implements the IComparable interface to enable easy sorting of this class by major/minor/patch values.
NOTE: Not all versions of Ethos resources are Semantic versions. Therefore, this class should only be used in support of those versions of resources following Semantic version notation.
Inheritance
Namespace: Ellucian.Ethos.Integration.Config
Assembly: Ellucian.Ethos.Integration.dll
Syntax
public class SemVer : IComparable<SemVer>
Properties
Major
The major version.
Declaration
public int Major { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Minor
The minor version.
Declaration
public int Minor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Patch
The patch version.
Declaration
public int Patch { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
CompareTo(SemVer)
Compares this object to the given object, which should also be an instance of this class. Compares by the major, then minor, then patch values. Returns the difference between the major, minor, and patch values.If the difference of the major values is 0, then takes the difference of the minor values.If the difference of the minor values is also 0, then it returns the difference of the patch values.
Declaration
public int CompareTo(SemVer sv = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SemVer | sv | Another SemVer instance to compare against this one. |
Returns
| Type | Description |
|---|---|
| System.Int32 | A negative value if this SemVer is less than the given SemVer object, a positive value if this SemVer is greater than the given SemVer object, or 0 if they are equal. |
Equals(Object)
Overrides the equals method to compare on the major, minor, and patch values.
Declaration
public override bool Equals(Object o)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | o | The object to compare equality against, expected to be another instance of this class. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the given SemVer object has the same major, minor, and patch values. False otherwise. |
GetHashCode()
Overrides the hashCode to compute and return the hashCode value comprised of the major, minor, and patch values of this class.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code computed from the major, minor, and patch values of this class. |
ToString()
Returns a string representation of this object containing the SemVer notation of the major.minor.patch values.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | This object as a semantic version string such as 5.24.12 or 6.23.14. |