Skip to content

Class ReleaseVersion

Namespace: Void.Minecraft
Assembly: Void.Minecraft.dll

Represents a Minecraft release version number in Major.Minor[.Patch] form.

public record ReleaseVersion : IComparable<ReleaseVersion>, IEquatable<ReleaseVersion>

Inheritance

objectReleaseVersion

Implements

IComparable<ReleaseVersion>, IEquatable<ReleaseVersion>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks

Patch is optional: when it is 0, omits it and returns the two-component form (for example, "1.21"). A non-zero patch produces the three-component form (for example, "1.21.4").

Ordering follows the natural numeric ordering of the components: Major first, then Minor, then Patch.

Implicit conversions are provided in both directions so that a can be assigned from or cast to a string without an explicit call to .

Constructors

ReleaseVersion(ushort, ushort, ushort)

Represents a Minecraft release version number in Major.Minor[.Patch] form.

public ReleaseVersion(ushort Major, ushort Minor, ushort Patch)

Parameters

Major ushort

The major component of the version number (for example, 1 in 1.21.4).

Minor ushort

The minor component of the version number (for example, 21 in 1.21.4).

Patch ushort

The patch component of the version number (for example, 4 in 1.21.4). Pass 0 for releases that have no patch segment.

Remarks

Patch is optional: when it is 0, omits it and returns the two-component form (for example, "1.21"). A non-zero patch produces the three-component form (for example, "1.21.4").

Ordering follows the natural numeric ordering of the components: Major first, then Minor, then Patch.

Implicit conversions are provided in both directions so that a can be assigned from or cast to a string without an explicit call to .

Properties

Major

The major component of the version number (for example, 1 in 1.21.4).

public ushort Major { get; init; }

Property Value

ushort

Minor

The minor component of the version number (for example, 21 in 1.21.4).

public ushort Minor { get; init; }

Property Value

ushort

Patch

The patch component of the version number (for example, 4 in 1.21.4). Pass 0 for releases that have no patch segment.

public ushort Patch { get; init; }

Property Value

ushort

Methods

CompareTo(ReleaseVersion?)

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(ReleaseVersion? other)

Parameters

other ReleaseVersion?

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.

Parse(string)

public static ReleaseVersion Parse(string versionString)

Parameters

versionString string

Returns

ReleaseVersion

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 ReleaseVersion)

public static bool TryParse(string versionString, out ReleaseVersion version)

Parameters

versionString string

version ReleaseVersion

Returns

bool

Operators

implicit operator ReleaseVersion(string)

public static implicit operator ReleaseVersion(string versionString)

Parameters

versionString string

Returns

ReleaseVersion

implicit operator string(ReleaseVersion)

public static implicit operator string(ReleaseVersion version)

Parameters

version ReleaseVersion

Returns

string