Edit

Share via


ValueArray<T> Struct

Definition

This implements an array that is as a whole a value type. The maximum number of elements in the array is 8.

[System.Serializable]
public struct ValueArray<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T> where T : struct
[<System.Serializable>]
type ValueArray<'T (requires 'T : struct)> = struct
    interface IList<'T (requires 'T : struct)>
    interface ICollection<'T (requires 'T : struct)>
    interface seq<'T (requires 'T : struct)>
    interface IEnumerable
    interface IReadOnlyCollection<'T (requires 'T : struct)>
    interface IReadOnlyList<'T (requires 'T : struct)>
Public Structure ValueArray(Of T)
Implements ICollection(Of T), IEnumerable(Of T), IList(Of T), IReadOnlyCollection(Of T), IReadOnlyList(Of T)

Type Parameters

T

The type of the elements. Must be a value type as well.

Inheritance
ValueArray<T>
Attributes
Implements

Constructors

ValueArray<T>(Int32)

Creates a new value array with the given initial number of elements

Fields

MaximumSize

The maximum size of this array. This value is constant.

Properties

Count

Gets or sets the number of elements in the collection. Unlike for List<T>, this member is writable, to enable the behavior of Array

IsReadOnly

Gets a value indicating whether the ICollection<T> is read-only.

Item[Int32]

Gets or sets the element at the specified index.

Methods

Add(T)

Adds an item to the ICollection<T>.

AsSpan()

Returns a span pointing to this instance

Clear()

Removes all items from the ICollection<T>.

Contains(T)

Determines whether the ICollection<T> contains a specific value.

CopyTo(T[], Int32)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

GetEnumerator()

Returns an enumerator that iterates through the collection.

IndexOf(T)

Determines the index of a specific item in the IList<T>.

Insert(Int32, T)

Inserts an item to the IList<T> at the specified index.

Remove(T)

Removes the first occurrence of a specific object from the ICollection<T>.

RemoveAt(Int32)

Removes the IList<T> item at the specified index.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Applies to