Skip to content

Class NumericTag<T>

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

Abstract base class for types that contain a single numeric value.

public abstract class NumericTag<T> : Tag, IEquatable<Tag>, ICloneable, IEquatable<NumericTag<T>>, IComparable<NumericTag<T>>, IComparable where T : unmanaged, INumber<T>

Type Parameters

T

A value type that implements .

Inheritance

objectTagNumericTag<T>

Implements

IEquatable<Tag>, ICloneable, IEquatable<NumericTag<T>>, IComparable<NumericTag<T>>, IComparable

Inherited Members

Tag.NoName, Tag.Type, Tag.Parent, Tag.Name, Tag.PrettyPrinted(StringBuilder, int, string), Tag.PrettyName, Tag.WriteJson(Utf8JsonWriter, bool), Tag.WriteJson(Stream, JsonWriterOptions?), Tag.WriteJsonAsync(Stream, JsonWriterOptions?), Tag.ToJson(JsonWriterOptions?), Tag.ToJsonString(bool, string), Tag.Equals(Tag?), Tag.Equals(object?), Tag.GetHashCode(), Tag.Clone(), Tag.Stringify(bool), Tag.StringifyName, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

NumericTag(TagType, string?, T)

protected NumericTag(TagType type, string? name, T value)

Parameters

type TagType

name string?

value T

Properties

Value

Gets or sets the value of the tag.

public T Value { get; set; }

Property Value

T

Methods

CompareTo(NumericTag<T>?)

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

Parameters

other NumericTag<T>?

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.

CompareTo(object?)

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(object? obj)

Parameters

obj object?

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 obj in the sort order.
Zero This instance occurs in the same position in the sort order as obj.
Greater than zero This instance follows obj in the sort order.

Exceptions

ArgumentException

obj is not the same type as this instance.

Equals(NumericTag<T>?)

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

public bool Equals(NumericTag<T>? other)

Parameters

other NumericTag<T>?

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.

Operators

operator ==(NumericTag<T>?, NumericTag<T>?)

Compares two values to determine equality.

public static bool operator ==(NumericTag<T>? left, NumericTag<T>? right)

Parameters

left NumericTag<T>?

The value to compare with right.

right NumericTag<T>?

The value to compare with left.

Returns

bool

true if left is equal to right; otherwise, false.

operator >(NumericTag<T>?, NumericTag<T>?)

Compares two values to determine which is greater.

public static bool operator >(NumericTag<T>? left, NumericTag<T>? right)

Parameters

left NumericTag<T>?

The value to compare with right.

right NumericTag<T>?

The value to compare with left.

Returns

bool

true if left is greater than right; otherwise, false.

operator >=(NumericTag<T>?, NumericTag<T>?)

Compares two values to determine which is greater or equal.

public static bool operator >=(NumericTag<T>? left, NumericTag<T>? right)

Parameters

left NumericTag<T>?

The value to compare with right.

right NumericTag<T>?

The value to compare with left.

Returns

bool

true if left is greater than or equal to right; otherwise, false.

implicit operator T(NumericTag<T>)

Implicit conversion of a to a T.

public static implicit operator T(NumericTag<T> tag)

Parameters

tag NumericTag<T>

The to be converted.

Returns

T

The value of tag as a T.

operator !=(NumericTag<T>?, NumericTag<T>?)

Compares two values to determine inequality.

public static bool operator !=(NumericTag<T>? left, NumericTag<T>? right)

Parameters

left NumericTag<T>?

The value to compare with right.

right NumericTag<T>?

The value to compare with left.

Returns

bool

true if left is not equal to right; otherwise, false.

operator <(NumericTag<T>?, NumericTag<T>?)

Compares two values to determine which is less.

public static bool operator <(NumericTag<T>? left, NumericTag<T>? right)

Parameters

left NumericTag<T>?

The value to compare with right.

right NumericTag<T>?

The value to compare with left.

Returns

bool

true if left is less than right; otherwise, false.

operator <=(NumericTag<T>?, NumericTag<T>?)

Compares two values to determine which is less or equal.

public static bool operator <=(NumericTag<T>? left, NumericTag<T>? right)

Parameters

left NumericTag<T>?

The value to compare with right.

right NumericTag<T>?

The value to compare with left.

Returns

bool

true if left is less than or equal to right; otherwise, false.