Table of Contents

Class SemVersion

Namespace
Nite.Packages
Assembly
Nite.dll

A semantic version, compared per semver 2.0 (build metadata is ignored).

public sealed class SemVersion : IComparable<SemVersion>, IEquatable<SemVersion>
Inheritance
SemVersion
Implements
Inherited Members

Constructors

SemVersion(int, int, int, IReadOnlyList<string>?)

public SemVersion(int major, int minor, int patch, IReadOnlyList<string>? prerelease = null)

Parameters

major int
minor int
patch int
prerelease IReadOnlyList<string>

Properties

IsPrerelease

public bool IsPrerelease { get; }

Property Value

bool

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 IReadOnlyList<string> Prerelease { get; }

Property Value

IReadOnlyList<string>

Methods

CompareTo(SemVersion?)

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

Parameters

other SemVersion

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(SemVersion?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(SemVersion? other)

Parameters

other SemVersion

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)

public static SemVersion Parse(string text)

Parameters

text string

Returns

SemVersion

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 SemVersion?)

public static bool TryParse(string? text, out SemVersion? version)

Parameters

text string
version SemVersion

Returns

bool

Operators

operator >(SemVersion, SemVersion)

public static bool operator >(SemVersion a, SemVersion b)

Parameters

a SemVersion
b SemVersion

Returns

bool

operator >=(SemVersion, SemVersion)

public static bool operator >=(SemVersion a, SemVersion b)

Parameters

a SemVersion
b SemVersion

Returns

bool

operator <(SemVersion, SemVersion)

public static bool operator <(SemVersion a, SemVersion b)

Parameters

a SemVersion
b SemVersion

Returns

bool

operator <=(SemVersion, SemVersion)

public static bool operator <=(SemVersion a, SemVersion b)

Parameters

a SemVersion
b SemVersion

Returns

bool