Class SemVer
- Namespace
- ProperVersion
- Assembly
- VintagestoryAPI.dll
Implementation of Semantic Verisoning standard, version 2.0.0. See https://semver.org/ for specifications.
public class SemVer : IComparable<SemVer>, IEquatable<SemVer>
- Inheritance
-
SemVer
- Implements
- Inherited Members
- Extension Methods
Constructors
SemVer(int, int, int)
public SemVer(int major, int minor, int patch)
Parameters
SemVer(int, int, int, string, string)
public SemVer(int major, int minor, int patch, string preRelease = "", string buildMetadata = "")
Parameters
SemVer(int, int, int, string[], string[])
public SemVer(int major, int minor, int patch, string[] preReleaseIdentifiers = null, string[] buildMetadataIdentifiers = null)
Parameters
Properties
BuildMetadata
public string BuildMetadata { get; }
Property Value
BuildMetadataIdentifiers
public string[] BuildMetadataIdentifiers { get; }
Property Value
- string[]
Major
public int Major { get; }
Property Value
Minor
public int Minor { get; }
Property Value
Patch
public int Patch { get; }
Property Value
PreRelease
public string PreRelease { get; }
Property Value
PreReleaseIdentifiers
public string[] PreReleaseIdentifiers { get; }
Property Value
- string[]
Methods
Compare(SemVer, SemVer)
public static int Compare(SemVer left, SemVer right)
Parameters
Returns
CompareTo(SemVer)
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(SemVer other)
Parameters
other
SemVerAn 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:
Value Meaning Less than zero This instance precedes other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
Equals(SemVer)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(SemVer other)
Parameters
other
SemVerAn object to compare with this object.
Returns
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.
Parse(string)
Converts the specified string representation of a semantic version to its SemVer equivalent.
public static SemVer Parse(string s)
Parameters
s
string
Returns
Exceptions
- ArgumentNullException
Thrown if the specified string is null.
- FormatException
Thrown if the specified string doesn't contain a proper properly formatted semantic version.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryParse(string, out SemVer)
Tries to convert the specified string representation of a semantic version to its SemVer equivalent, returning true if successful.
public static bool TryParse(string s, out SemVer result)
Parameters
s
stringresult
SemVerWhen this method returns, contains a valid, non-null SemVer, If the conversion failed, this is set to the parser's best guess.
Returns
Exceptions
- ArgumentNullException
Thrown if the specified string is null.
TryParse(string, out SemVer, out string)
Tries to convert the specified string representation of a semantic version to its SemVer equivalent, returning true if successful.
public static bool TryParse(string s, out SemVer result, out string error)
Parameters
s
stringresult
SemVerWhen this method returns, contains a valid, non-null SemVer, If the conversion failed, this is set to the method's best guess.
error
stringWhen this method returns, contains the first error describing why the conversion failed, or null if it succeeded.
Returns
Exceptions
- ArgumentNullException
Thrown if the specified string is null.
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
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)