Struct Semver
- Namespace
- JLChnToZ.VRC.Foundation
A simple semantic versioning implementation that supports parsing, comparison, and equality checks.
public readonly struct Semver : IComparable<Semver>, IEquatable<Semver>
- Implements
- Inherited Members
- Extension Methods
Properties
Build
Gets the build identifiers, if any.
public string Build { get; }
Property Value
IsPrerelease
Gets a value indicating whether this version is a pre-release version.
public bool IsPrerelease { get; }
Property Value
IsValid
Determines if this is a valid semantic version.
public bool IsValid { get; }
Property Value
Major
The major version number.
public int Major { get; }
Property Value
Minor
The minor version number.
public int Minor { get; }
Property Value
Patch
The patch version number.
public int Patch { get; }
Property Value
Prerelease
Gets the pre-release identifiers, if any.
public string Prerelease { get; }
Property Value
Methods
CompareTo(Semver)
Compares this instance with another Semver instance.
public int CompareTo(Semver other)
Parameters
Returns
- int
An integer that indicates the relative order of the instances.
Equals(Semver)
Checks if this instance is equal to another Semver instance.
public bool Equals(Semver other)
Parameters
Returns
- bool
True if the instances are equal; otherwise, false.
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
TryParse(string, out Semver)
Tries to parse a semantic version string into a Semver instance.
public static bool TryParse(string version, out Semver result)
Parameters
versionstringThe version string to parse.
resultSemverThe parsed Semver instance if parsing succeeds.
Returns
- bool
True if parsing was successful; otherwise, false.
Operators
operator ==(Semver, Semver)
public static bool operator ==(Semver left, Semver right)
Parameters
Returns
operator >(Semver, Semver)
public static bool operator >(Semver left, Semver right)
Parameters
Returns
operator >=(Semver, Semver)
public static bool operator >=(Semver left, Semver right)
Parameters
Returns
implicit operator Semver(string)
public static implicit operator Semver(string str)
Parameters
strstring
Returns
operator !=(Semver, Semver)
public static bool operator !=(Semver left, Semver right)
Parameters
Returns
operator <(Semver, Semver)
public static bool operator <(Semver left, Semver right)
Parameters
Returns
operator <=(Semver, Semver)
public static bool operator <=(Semver left, Semver right)