docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct FixedList64Bytes<T>

    An unmanaged, resizable list whose content is all stored directly in the 64-byte struct. Useful for small lists.

    Implements
    INativeList<T>
    IIndexable<T>
    Namespace: Unity.Collections
    Assembly: Unity.Collections.dll
    Syntax
    [Serializable]
    public struct FixedList64Bytes<T> : INativeList<T>, IIndexable<T> where T : unmanaged
    Type Parameters
    Name Description
    T

    The type of the elements.

    Constructors

    FixedList64Bytes(in FixedList128Bytes<T>)

    Initializes and returns an instance of FixedList64Bytes with content copied from another list.

    Declaration
    public FixedList64Bytes(in FixedList128Bytes<T> other)
    Parameters
    Type Name Description
    FixedList128Bytes<T> other

    The list to copy.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    FixedList64Bytes(in FixedList32Bytes<T>)

    Initializes and returns an instance of FixedList64Bytes with content copied from another list.

    Declaration
    public FixedList64Bytes(in FixedList32Bytes<T> other)
    Parameters
    Type Name Description
    FixedList32Bytes<T> other

    The list to copy.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    FixedList64Bytes(in FixedList4096Bytes<T>)

    Initializes and returns an instance of FixedList64Bytes with content copied from another list.

    Declaration
    public FixedList64Bytes(in FixedList4096Bytes<T> other)
    Parameters
    Type Name Description
    FixedList4096Bytes<T> other

    The list to copy.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    FixedList64Bytes(in FixedList512Bytes<T>)

    Initializes and returns an instance of FixedList64Bytes with content copied from another list.

    Declaration
    public FixedList64Bytes(in FixedList512Bytes<T> other)
    Parameters
    Type Name Description
    FixedList512Bytes<T> other

    The list to copy.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    Properties

    Capacity

    The number of elements that can fit in this list.

    Declaration
    public int Capacity { readonly get; set; }
    Property Value
    Type Description
    int

    The number of elements that can fit in this list.

    Remarks

    The capacity of a FixedList cannot be changed. The setter is included only for conformity with INativeList<T>.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the new value does not match the current capacity.

    IsEmpty

    Whether this list is empty.

    Declaration
    public readonly bool IsEmpty { get; }
    Property Value
    Type Description
    bool

    True if this string has no characters or if the container has not been constructed.

    this[int]

    The element at a given index.

    Declaration
    public T this[int index] { readonly get; set; }
    Parameters
    Type Name Description
    int index

    An index.

    Property Value
    Type Description
    T

    The value to store at the index.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the index is out of bounds.

    Length

    The current number of items in this list.

    Declaration
    [CreateProperty]
    public int Length { readonly get; set; }
    Property Value
    Type Description
    int

    The current number of items in this list.

    Methods

    Add(in T)

    Appends an element to the end of this list. Increments the length by 1.

    Declaration
    public void Add(in T item)
    Parameters
    Type Name Description
    T item

    The element to append at the end of the list.

    Remarks

    The same as AddNoResize(in T). Included only for consistency with the other list types. If the element exceeds the capacity, throws cref="IndexOutOfRangeException", and the list is unchanged.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the append exceeds the capacity.

    AddNoResize(in T)

    Appends an element to the end of this list. Increments the length by 1.

    Declaration
    public void AddNoResize(in T item)
    Parameters
    Type Name Description
    T item

    The element to append at the end of the list.

    Remarks

    If the element exceeds the capacity, throws cref="IndexOutOfRangeException", and the list is unchanged.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the append exceeds the capacity.

    AddRange(void*, int)

    Appends elements from a buffer to the end of this list. Increments the length by the number of appended elements.

    Declaration
    public void AddRange(void* ptr, int length)
    Parameters
    Type Name Description
    void* ptr

    A buffer.

    int length

    The number of elements from the buffer to append.

    Remarks

    The same as AddRangeNoResize(void*, int). Included only for consistency with the other list types. If the elements exceeds the capacity, throws cref="IndexOutOfRangeException", and the list is unchanged.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the append exceeds the capacity.

    AddRangeNoResize(void*, int)

    Appends elements from a buffer to the end of this list. Increments the length by the number of appended elements.

    Declaration
    public void AddRangeNoResize(void* ptr, int length)
    Parameters
    Type Name Description
    void* ptr

    A buffer.

    int length

    The number of elements from the buffer to append.

    Remarks

    If the elements exceeds the capacity, throws cref="IndexOutOfRangeException", and the list is unchanged.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the append exceeds the capacity.

    AddReplicate(in T, int)

    Appends value count times to the end of this list.

    Declaration
    public void AddReplicate(in T value, int count)
    Parameters
    Type Name Description
    T value

    The value to add to the end of this list.

    int count

    The number of times to replicate the value.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the append exceeds the capacity.

    Clear()

    Sets the length to 0.

    Declaration
    public void Clear()
    Remarks

    Does not zero out the bytes.

    CompareTo(FixedList128Bytes<T>)

    Returns a number denoting whether this list should be placed before or after another list in a sort.

    Declaration
    public int CompareTo(FixedList128Bytes<T> other)
    Parameters
    Type Name Description
    FixedList128Bytes<T> other

    A list to to compare with.

    Returns
    Type Description
    int

    An integer denoting the respective sort position of the list relative to the other:

     0 denotes that both lists should have the same position in a sort.
     -1 denotes that this list should precede the other list in a sort.
     +1 denotes that this list should follow the other list in a sort.
    

    CompareTo(FixedList32Bytes<T>)

    Returns a number denoting whether this list should be placed before or after another list in a sort.

    Declaration
    public int CompareTo(FixedList32Bytes<T> other)
    Parameters
    Type Name Description
    FixedList32Bytes<T> other

    A list to to compare with.

    Returns
    Type Description
    int

    An integer denoting the respective sort position of the list relative to the other:

     0 denotes that both lists should have the same position in a sort.
     -1 denotes that this list should precede the other list in a sort.
     +1 denotes that this list should follow the other list in a sort.
    

    CompareTo(FixedList4096Bytes<T>)

    Returns a number denoting whether this list should be placed before or after another list in a sort.

    Declaration
    public int CompareTo(FixedList4096Bytes<T> other)
    Parameters
    Type Name Description
    FixedList4096Bytes<T> other

    A list to to compare with.

    Returns
    Type Description
    int

    An integer denoting the respective sort position of the list relative to the other:

     0 denotes that both lists should have the same position in a sort.
     -1 denotes that this list should precede the other list in a sort.
     +1 denotes that this list should follow the other list in a sort.
    

    CompareTo(FixedList512Bytes<T>)

    Returns a number denoting whether this list should be placed before or after another list in a sort.

    Declaration
    public int CompareTo(FixedList512Bytes<T> other)
    Parameters
    Type Name Description
    FixedList512Bytes<T> other

    A list to to compare with.

    Returns
    Type Description
    int

    An integer denoting the respective sort position of the list relative to the other:

     0 denotes that both lists should have the same position in a sort.
     -1 denotes that this list should precede the other list in a sort.
     +1 denotes that this list should follow the other list in a sort.
    

    CompareTo(FixedList64Bytes<T>)

    Returns a number denoting whether this list should be placed before or after another list in a sort.

    Declaration
    public int CompareTo(FixedList64Bytes<T> other)
    Parameters
    Type Name Description
    FixedList64Bytes<T> other

    A list to to compare with.

    Returns
    Type Description
    int

    An integer denoting the respective sort position of the list relative to the other:

     0 denotes that both lists should have the same position in a sort.
     -1 denotes that this list should precede the other list in a sort.
     +1 denotes that this list should follow the other list in a sort.
    

    ElementAt(int)

    Returns the element at a given index.

    Declaration
    public ref T ElementAt(int index)
    Parameters
    Type Name Description
    int index

    An index.

    Returns
    Type Description
    T

    The list element at the index.

    Equals(object)

    Returns true if the list is equal to an object.

    Declaration
    [ExcludeFromBurstCompatTesting("Takes managed object")]
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    An object to compare for equality.

    Returns
    Type Description
    bool

    True if the list is equal to the object.

    Overrides
    ValueType.Equals(object)
    Remarks

    Two lists are equal if their length and bytes are equal.

     A FixedList*N*<T> can only be equal to another FixedList*N*<T> with the same *N* and T.
    

    Equals(FixedList128Bytes<T>)

    Returns true if this list and another list are equal.

    Declaration
    public bool Equals(FixedList128Bytes<T> other)
    Parameters
    Type Name Description
    FixedList128Bytes<T> other

    The list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    Equals(FixedList32Bytes<T>)

    Returns true if this list and another list are equal.

    Declaration
    public bool Equals(FixedList32Bytes<T> other)
    Parameters
    Type Name Description
    FixedList32Bytes<T> other

    The list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    Equals(FixedList4096Bytes<T>)

    Returns true if this list and another list are equal.

    Declaration
    public bool Equals(FixedList4096Bytes<T> other)
    Parameters
    Type Name Description
    FixedList4096Bytes<T> other

    The list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    Equals(FixedList512Bytes<T>)

    Returns true if this list and another list are equal.

    Declaration
    public bool Equals(FixedList512Bytes<T> other)
    Parameters
    Type Name Description
    FixedList512Bytes<T> other

    The list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    Equals(FixedList64Bytes<T>)

    Returns true if this list and another list are equal.

    Declaration
    public bool Equals(FixedList64Bytes<T> other)
    Parameters
    Type Name Description
    FixedList64Bytes<T> other

    The list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    GetEnumerator()

    Returns an enumerator for iterating over the elements of this list.

    Declaration
    public FixedList64Bytes<T>.Enumerator GetEnumerator()
    Returns
    Type Description
    FixedList64Bytes<T>.Enumerator

    An enumerator for iterating over the elements of this list.

    GetHashCode()

    Returns the hash code of this list.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    The hash code of this list.

    Overrides
    ValueType.GetHashCode()
    Remarks

    Only the content of the list (the bytes of the elements) are included in the hash. Any bytes beyond the length are not part of the hash.

    Insert(int, in T)

    Inserts a single element at an index. Increments the length by 1.

    Declaration
    public void Insert(int index, in T item)
    Parameters
    Type Name Description
    int index

    The index at which to insert the element.

    T item

    The element to insert.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the index is out of bounds.

    InsertRange(int, int)

    Shifts elements toward the end of this list, increasing its length.

    Declaration
    public void InsertRange(int index, int count)
    Parameters
    Type Name Description
    int index

    The index of the first element that will be shifted up.

    int count

    The number of elements to insert.

    Remarks

    Right-shifts elements in the list so as to create 'free' slots at the beginning or in the middle.

    The length is increased by count. If necessary, the capacity will be increased accordingly.

    If count equals 0, the method does nothing.

    The element at index index will be copied to index index + count, the element at index index + 1 will be copied to index + count + 1, and so forth.

    The indexes index up to index + count are not cleared: they will contain whatever values they held prior.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if count is negative.

    ArgumentOutOfRangeException

    Thrown if index is out of bounds.

    InsertRangeWithBeginEnd(int, int)

    Shifts elements toward the end of this list, increasing its length.

    Declaration
    public void InsertRangeWithBeginEnd(int begin, int end)
    Parameters
    Type Name Description
    int begin

    The index of the first element that will be shifted up.

    int end

    The index where the first shifted element will end up.

    Remarks

    Right-shifts elements in the list so as to create 'free' slots at the beginning or in the middle.

    The length is increased by end - begin.

    If end equals begin, the method does nothing.

    The element at index begin will be copied to index end, the element at index begin + 1 will be copied to end + 1, and so forth.

    The indexes begin up to end are not cleared: they will contain whatever values they held prior.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the new length exceeds the capacity.

    RemoveAt(int)

    Removes the element at an index. Shifts everything above the index down by one and decrements the length by 1.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    int index

    The index of the element to remove.

    Remarks

    If you don't care about preserving the order of the elements, RemoveAtSwapBack is a more efficient way to remove an element.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the index is out of bounds.

    RemoveAtSwapBack(int)

    Copies the last element of this list to an index. Decrements the length by 1.

    Declaration
    public void RemoveAtSwapBack(int index)
    Parameters
    Type Name Description
    int index

    The index to overwrite with the last element.

    Remarks

    Useful as a cheap way to remove elements from a list when you don't care about preserving order.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the index is out of bounds.

    RemoveRange(int, int)

    Removes N elements of a range. Shifts everything above the range down by N and decrements the length by N.

    Declaration
    public void RemoveRange(int index, int count)
    Parameters
    Type Name Description
    int index

    The first index of the range to remove.

    int count

    The number of elements to remove.

    Remarks

    If you don't care about preserving the order of the elements, RemoveAtSwapBack is a more efficient way to remove elements.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the index is out of bounds.

    RemoveRangeSwapBack(int, int)

    Copies the last N elements of this list to a range in this list. Decrements the length by N.

    Declaration
    public void RemoveRangeSwapBack(int index, int count)
    Parameters
    Type Name Description
    int index

    The first index of the destination range.

    int count

    The number of elements to copy and the amount by which to decrement the length.

    Remarks

    Copies the last count-numbered elements to the range starting at index.

    Useful as a cheap way to remove elements from a list when you don't care about preserving order.

    Does nothing if the count is less than 1.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if the index is out of bounds.

    ToArray()

    Returns a managed array that is a copy of this list.

    Declaration
    [ExcludeFromBurstCompatTesting("Returns managed array")]
    public T[] ToArray()
    Returns
    Type Description
    T[]

    A managed array that is a copy of this list.

    ToNativeArray(AllocatorHandle)

    Returns an array that is a copy of this list.

    Declaration
    public NativeArray<T> ToNativeArray(AllocatorManager.AllocatorHandle allocator)
    Parameters
    Type Name Description
    AllocatorManager.AllocatorHandle allocator

    The allocator to use.

    Returns
    Type Description
    NativeArray<T>

    An array that is a copy of this list.

    Operators

    operator ==(in FixedList64Bytes<T>, in FixedList128Bytes<T>)

    Returns true if two lists are equal.

    Declaration
    public static bool operator ==(in FixedList64Bytes<T> a, in FixedList128Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for equality.

    FixedList128Bytes<T> b

    The second list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator ==(in FixedList64Bytes<T>, in FixedList32Bytes<T>)

    Returns true if two lists are equal.

    Declaration
    public static bool operator ==(in FixedList64Bytes<T> a, in FixedList32Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for equality.

    FixedList32Bytes<T> b

    The second list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator ==(in FixedList64Bytes<T>, in FixedList4096Bytes<T>)

    Returns true if two lists are equal.

    Declaration
    public static bool operator ==(in FixedList64Bytes<T> a, in FixedList4096Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for equality.

    FixedList4096Bytes<T> b

    The second list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator ==(in FixedList64Bytes<T>, in FixedList512Bytes<T>)

    Returns true if two lists are equal.

    Declaration
    public static bool operator ==(in FixedList64Bytes<T> a, in FixedList512Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for equality.

    FixedList512Bytes<T> b

    The second list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator ==(in FixedList64Bytes<T>, in FixedList64Bytes<T>)

    Returns true if two lists are equal.

    Declaration
    public static bool operator ==(in FixedList64Bytes<T> a, in FixedList64Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for equality.

    FixedList64Bytes<T> b

    The second list to compare for equality.

    Returns
    Type Description
    bool

    True if the two lists are equal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    implicit operator FixedList64Bytes<T>(in FixedList128Bytes<T>)

    Returns a new list that is a copy of another list.

    Declaration
    public static implicit operator FixedList64Bytes<T>(in FixedList128Bytes<T> other)
    Parameters
    Type Name Description
    FixedList128Bytes<T> other

    The list to copy.

    Returns
    Type Description
    FixedList64Bytes<T>

    A new list that is a copy of the other.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    implicit operator FixedList64Bytes<T>(in FixedList32Bytes<T>)

    Returns a new list that is a copy of another list.

    Declaration
    public static implicit operator FixedList64Bytes<T>(in FixedList32Bytes<T> other)
    Parameters
    Type Name Description
    FixedList32Bytes<T> other

    The list to copy.

    Returns
    Type Description
    FixedList64Bytes<T>

    A new list that is a copy of the other.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    implicit operator FixedList64Bytes<T>(in FixedList4096Bytes<T>)

    Returns a new list that is a copy of another list.

    Declaration
    public static implicit operator FixedList64Bytes<T>(in FixedList4096Bytes<T> other)
    Parameters
    Type Name Description
    FixedList4096Bytes<T> other

    The list to copy.

    Returns
    Type Description
    FixedList64Bytes<T>

    A new list that is a copy of the other.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    implicit operator FixedList64Bytes<T>(in FixedList512Bytes<T>)

    Returns a new list that is a copy of another list.

    Declaration
    public static implicit operator FixedList64Bytes<T>(in FixedList512Bytes<T> other)
    Parameters
    Type Name Description
    FixedList512Bytes<T> other

    The list to copy.

    Returns
    Type Description
    FixedList64Bytes<T>

    A new list that is a copy of the other.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Throws if the other list's length exceeds the capacity of FixedList64Bytes<T>.

    operator !=(in FixedList64Bytes<T>, in FixedList128Bytes<T>)

    Returns true if two lists are unequal.

    Declaration
    public static bool operator !=(in FixedList64Bytes<T> a, in FixedList128Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for inequality.

    FixedList128Bytes<T> b

    The second list to compare for inequality.

    Returns
    Type Description
    bool

    True if the two lists are unequal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator !=(in FixedList64Bytes<T>, in FixedList32Bytes<T>)

    Returns true if two lists are unequal.

    Declaration
    public static bool operator !=(in FixedList64Bytes<T> a, in FixedList32Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for inequality.

    FixedList32Bytes<T> b

    The second list to compare for inequality.

    Returns
    Type Description
    bool

    True if the two lists are unequal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator !=(in FixedList64Bytes<T>, in FixedList4096Bytes<T>)

    Returns true if two lists are unequal.

    Declaration
    public static bool operator !=(in FixedList64Bytes<T> a, in FixedList4096Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for inequality.

    FixedList4096Bytes<T> b

    The second list to compare for inequality.

    Returns
    Type Description
    bool

    True if the two lists are unequal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator !=(in FixedList64Bytes<T>, in FixedList512Bytes<T>)

    Returns true if two lists are unequal.

    Declaration
    public static bool operator !=(in FixedList64Bytes<T> a, in FixedList512Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for inequality.

    FixedList512Bytes<T> b

    The second list to compare for inequality.

    Returns
    Type Description
    bool

    True if the two lists are unequal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    operator !=(in FixedList64Bytes<T>, in FixedList64Bytes<T>)

    Returns true if two lists are unequal.

    Declaration
    public static bool operator !=(in FixedList64Bytes<T> a, in FixedList64Bytes<T> b)
    Parameters
    Type Name Description
    FixedList64Bytes<T> a

    The first list to compare for inequality.

    FixedList64Bytes<T> b

    The second list to compare for inequality.

    Returns
    Type Description
    bool

    True if the two lists are unequal.

    Remarks

    Two lists are equal if their length and bytes are equal.

    Implements

    INativeList<T>
    IIndexable<T>

    Extension Methods

    FixedList64BytesExtensions.Contains<T, U>(ref FixedList64Bytes<T>, U)
    FixedList64BytesExtensions.IndexOf<T, U>(ref FixedList64Bytes<T>, U)
    FixedList64BytesExtensions.RemoveSwapBack<T, U>(ref FixedList64Bytes<T>, U)
    FixedList64BytesExtensions.Remove<T, U>(ref FixedList64Bytes<T>, U)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)