Table of Contents

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

major int
minor int
patch int

SemVer(int, int, int, string, string)

public SemVer(int major, int minor, int patch, string preRelease = "", string buildMetadata = "")

Parameters

major int
minor int
patch int
preRelease string
buildMetadata string

SemVer(int, int, int, string[], string[])

public SemVer(int major, int minor, int patch, string[] preReleaseIdentifiers = null, string[] buildMetadataIdentifiers = null)

Parameters

major int
minor int
patch int
preReleaseIdentifiers string[]
buildMetadataIdentifiers string[]

Properties

BuildMetadata

public string BuildMetadata { get; }

Property Value

string

BuildMetadataIdentifiers

public string[] BuildMetadataIdentifiers { get; }

Property Value

string[]

Major

public int Major { get; }

Property Value

int

Minor

public int Minor { get; }

Property Value

int

Patch

public int Patch { get; }

Property Value

int

PreRelease

public string PreRelease { get; }

Property Value

string

PreReleaseIdentifiers

public string[] PreReleaseIdentifiers { get; }

Property Value

string[]

Methods

Compare(SemVer, SemVer)

public static int Compare(SemVer left, SemVer right)

Parameters

left SemVer
right SemVer

Returns

int

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 SemVer

An 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 SemVer

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

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

SemVer

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 string
result SemVer

When this method returns, contains a valid, non-null SemVer, If the conversion failed, this is set to the parser's best guess.

Returns

bool

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 string
result SemVer

When this method returns, contains a valid, non-null SemVer, If the conversion failed, this is set to the method's best guess.

error string

When this method returns, contains the first error describing why the conversion failed, or null if it succeeded.

Returns

bool

Exceptions

ArgumentNullException

Thrown if the specified string is null.

Operators

operator ==(SemVer, SemVer)

public static bool operator ==(SemVer left, SemVer right)

Parameters

left SemVer
right SemVer

Returns

bool

operator >(SemVer, SemVer)

public static bool operator >(SemVer left, SemVer right)

Parameters

left SemVer
right SemVer

Returns

bool

operator >=(SemVer, SemVer)

public static bool operator >=(SemVer left, SemVer right)

Parameters

left SemVer
right SemVer

Returns

bool

operator !=(SemVer, SemVer)

public static bool operator !=(SemVer left, SemVer right)

Parameters

left SemVer
right SemVer

Returns

bool

operator <(SemVer, SemVer)

public static bool operator <(SemVer left, SemVer right)

Parameters

left SemVer
right SemVer

Returns

bool

operator <=(SemVer, SemVer)

public static bool operator <=(SemVer left, SemVer right)

Parameters

left SemVer
right SemVer

Returns

bool