Skip to content

Class ArrayTag<T>

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

Base class for NBT tags that contain a fixed-size array of numeric types.

public abstract class ArrayTag<T> : Tag, IEquatable<Tag>, ICloneable, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable where T : unmanaged, INumber<T>

Type Parameters

T

A value type that implements .

Inheritance

objectTagArrayTag<T>

Implements

IEquatable<Tag>, ICloneable, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable

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

Extension Methods

EnumerableExtensions.Synchronized<T>(IEnumerable<T>, AsyncLock, CancellationToken), EnumerableExtensions.SynchronizedAsync<T>(IEnumerable<T>, AsyncLock, CancellationToken)

Constructors

ArrayTag(TagType, string?, T[])

protected ArrayTag(TagType type, string? name, T[] value)

Parameters

type TagType

name string?

value T[]

The value of the tag.

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

Memory

Gets a over the tag data.

public Memory<T> Memory { get; }

Property Value

Memory<T>

Span

Gets a over the tag data.

public Span<T> Span { get; }

Property Value

Span<T>

this[int]

Gets or sets the element at the specified index.

public T this[int index] { get; set; }

Property Value

T

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the .

NotSupportedException

The property is set and the is read-only.

Methods

CopyTo(T[], int)

public void CopyTo(T[] array, int arrayIndex)

Parameters

array T[]

arrayIndex int

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

An enumerator that can be used to iterate through the collection.

GetPinnableReference()

Returns a reference to the underlying memory of this object that is be pinned using the fixed statement.

public ref T GetPinnableReference()

Returns

T

A reference to the first value in the underlying array.

IndexOf(T)

Determines the index of a specific item in the .

public int IndexOf(T item)

Parameters

item T

The object to locate in the .

Returns

int

The index of item if found in the list; otherwise, -1.

Slice(int, int)

Forms a slice out of the current span starting at a specified index for a specified length.

public Span<T> Slice(int start, int length)

Parameters

start int

The zero-based index at which to begin this slice.

length int

The desired length for the slice.

Returns

Span<T>

A span that consists of length elements from the current span starting at start.

Remarks

This method being defined provides Range indexers for the class.

Exceptions

ArgumentOutOfRangeException

start or start + length is less than zero or greater than .

Operators

implicit operator T[](ArrayTag<T>)

Implicit conversion of an to an array of T.

public static implicit operator T[](ArrayTag<T> tag)

Parameters

tag ArrayTag<T>

The to be converted.

Returns

T[]

The value of tag as an array of T.

implicit operator Span<T>(ArrayTag<T>)

Implicit conversion of an to a .

public static implicit operator Span<T>(ArrayTag<T> tag)

Parameters

tag ArrayTag<T>

The to be converted.

Returns

Span<T>

The value of tag as a .

implicit operator Memory<T>(ArrayTag<T>)

Implicit conversion of an to a .

public static implicit operator Memory<T>(ArrayTag<T> tag)

Parameters

tag ArrayTag<T>

The to be converted.

Returns

Memory<T>

The value of tag as a .