Struct FixedList128<T>
An unmanaged, resizable list that does not allocate memory. It is 128 bytes in size, and contains all the memory it needs.
Namespace: Unity.Collections
Syntax
public struct FixedList128<T> : INativeList<T>, IEnumerable<T>, IEnumerable, IEquatable<FixedList32<T>>, IComparable<FixedList32<T>>, IEquatable<FixedList64<T>>, IComparable<FixedList64<T>>, IEquatable<FixedList128<T>>, IComparable<FixedList128<T>>, IEquatable<FixedList512<T>>, IComparable<FixedList512<T>>, IEquatable<FixedList4096<T>>, IComparable<FixedList4096<T>> where T : struct
Type Parameters
Name | Description |
---|---|
T | The type of the elements in the container. |
Constructors
FixedList128(FixedList32<T>)
Constructs a new FixedList128<T> that is a copy of a FixedList32<T>.
Declaration
public FixedList128(in FixedList32<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | other | The FixedList32<T> to copy |
FixedList128(FixedList4096<T>)
Constructs a new FixedList128<T> that is a copy of a FixedList4096<T>.
Declaration
public FixedList128(in FixedList4096<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList4096<T> | other | The FixedList4096<T> to copy |
FixedList128(FixedList512<T>)
Constructs a new FixedList128<T> that is a copy of a FixedList512<T>.
Declaration
public FixedList128(in FixedList512<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList512<T> | other | The FixedList512<T> to copy |
FixedList128(FixedList64<T>)
Constructs a new FixedList128<T> that is a copy of a FixedList64<T>.
Declaration
public FixedList128(in FixedList64<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList64<T> | other | The FixedList64<T> to copy |
Properties
Capacity
The number of items that can fit in the list.
Declaration
public int Capacity { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The number of items that the list can hold. |
Implements
Remarks
Capacity specifies the number of items the list can currently hold. You can not change Capacity to fit more or fewer items.
Item[Int32]
Retrieve a member of the list by index.
Declaration
public T this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index into the list. |
Property Value
Type | Description |
---|---|
T | The list item at the specified index. |
Implements
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if index is negative or >= to Length. |
Length
The current number of items in the list.
Declaration
public int Length { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The item length. |
Implements
Methods
Add(T)
Adds an element to the list.
Declaration
public void Add(in T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The T to be added at the end of the list. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if list is already full. See Capacity. |
AddNoResize(T)
Adds an element to the list.
Declaration
public void AddNoResize(in T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The T to be added at the end of the list. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if list is already full. See Capacity. |
Clear()
Clears the list.
Declaration
public void Clear()
CompareTo(FixedList128<T>)
Compares this instance with a specified FixedList128<T> and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedList128<T>.
Declaration
public int CompareTo(FixedList128<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | other | The specified FixedList128<T> to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedList32<T>)
Compares this instance with a specified FixedList32<T> and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedList32<T>.
Declaration
public int CompareTo(FixedList32<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | other | The specified FixedList32<T> to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedList4096<T>)
Compares this instance with a specified FixedList4096<T> and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedList4096<T>.
Declaration
public int CompareTo(FixedList4096<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList4096<T> | other | The specified FixedList4096<T> to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedList512<T>)
Compares this instance with a specified FixedList512<T> and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedList512<T>.
Declaration
public int CompareTo(FixedList512<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList512<T> | other | The specified FixedList512<T> to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedList64<T>)
Compares this instance with a specified FixedList64<T> and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedList64<T>.
Declaration
public int CompareTo(FixedList64<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList64<T> | other | The specified FixedList64<T> to compare with |
Returns
Type | Description |
---|---|
Int32 |
Contains(T)
Determines whether an element is in the FixedList128<T>.
Declaration
public bool Contains(in T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the FixedList128<T>. |
Returns
Type | Description |
---|---|
Boolean |
ElementAt(Int32)
Declaration
public T ElementAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
T |
Implements
Equals(Object)
Compares this instance with a specified object and indicates whether this instance is equal to the specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The specified object to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Overrides
Equals(FixedList128<T>)
Compares this instance with a specified FixedList128<T> and indicates whether this instance is equal to the specified FixedList128<T>.
Declaration
public bool Equals(FixedList128<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | other | The specified FixedList128<T> to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedList32<T>)
Compares this instance with a specified FixedList32<T> and indicates whether this instance is equal to the specified FixedList32<T>.
Declaration
public bool Equals(FixedList32<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | other | The specified FixedList32<T> to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedList4096<T>)
Compares this instance with a specified FixedList4096<T> and indicates whether this instance is equal to the specified FixedList4096<T>.
Declaration
public bool Equals(FixedList4096<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList4096<T> | other | The specified FixedList4096<T> to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedList512<T>)
Compares this instance with a specified FixedList512<T> and indicates whether this instance is equal to the specified FixedList512<T>.
Declaration
public bool Equals(FixedList512<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList512<T> | other | The specified FixedList512<T> to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedList64<T>)
Compares this instance with a specified FixedList64<T> and indicates whether this instance is equal to the specified FixedList64<T>.
Declaration
public bool Equals(FixedList64<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList64<T> | other | The specified FixedList64<T> to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
GetEnumerator()
Returns an enumerator that iterates through a container.
Declaration
public FixedList128<T>.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
FixedList128.Enumerator<> | An IEnumerator object that can be used to iterate through the container. |
GetHashCode()
Computes a hash code summary of the FixedList128<T>.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
IndexOf(T)
Searches for the specified T and returns the zero-based index of the first occurrence within the entire FixedList128.
Declaration
public int IndexOf(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The T to locate in the FixedList128<T>. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(T, Int32)
Searches for the specified T and returns the zero-based index of the first occurrence within the range of elements in the FixedList128<T> that starts at the specified index.
Declaration
public int IndexOf(in T item, int index)
Parameters
Type | Name | Description |
---|---|---|
T | item | The T to locate in the FixedList128<T>. |
Int32 | index | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(T, Int32, Int32)
Searches for the specified T and returns the zero-based index of the first occurrence within the range of elements in the FixedList128<T> that starts at the specified index and contains the specified number of elements.
Declaration
public int IndexOf(in T item, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
T | item | The T to locate in the FixedList128<T>. |
Int32 | index | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |
Int32 | count | The number of elements in the section to search. |
Returns
Type | Description |
---|---|
Int32 |
Insert(Int32, T)
Inserts a single element into a FixedList128<T> at a specified zero-based index.
Declaration
public void Insert(int index, in T item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which the new element should be inserted. |
T | item | The element to insert |
InsertRange(Int32, Int32)
Inserts a number of items into a FixedList128<T> at a specified zero-based index.
Declaration
public void InsertRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The zero-based index at which the new elements should be inserted. |
Int32 | end |
Remove(T)
Searches for the specified T from the begining of the FixedList128<T> forward, removes it if possible, and returns true if the T was successfully removed.
Declaration
public bool Remove(in T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The T to locate in the FixedList128<T> |
Returns
Type | Description |
---|---|
Boolean |
RemoveAt(Int32)
Truncates the list by removing the item at the specified index, and shifting all remaining items to replace removed item. The list is shortened by one.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the item to delete. |
Remarks
This method of removing item is useful only in case when list is ordered and user wants to preserve order
in list after removal In majority of cases is not important and user should use more performant RemoveAtSwapBack
.
RemoveAtSwapBack(Int32)
Truncates the list by replacing the item at the specified index with the last item in the list. The list is shortened by one.
Declaration
public void RemoveAtSwapBack(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the item to delete. |
RemoveRange(Int32, Int32)
Truncates the list by removing the items at the specified index range, and shifting all remaining items to replace removed items. The list is shortened by number of elements in range.
Declaration
public void RemoveRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The first index of the item to remove. |
Int32 | end | The index past-the-last item to remove. |
Remarks
This method of removing item(s) is useful only in case when list is ordered and user wants to preserve order
in list after removal In majority of cases is not important and user should use more performant RemoveRangeSwapBack
.
RemoveRangeSwapBack(Int32, Int32)
Truncates the list by replacing the item at the specified index range with the items from the end the list. The list is shortened by number of elements in range.
Declaration
public void RemoveRangeSwapBack(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The first index of the item to remove. |
Int32 | end | The index past-the-last item to remove. |
RemoveSwapBack(T)
Removes the first occurrence of an item from the FixedList128<T> and replaces it with the last element, which can be much faster than copying down all subsequent elements.
Declaration
public void RemoveSwapBack(in T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The elements to remove from the FixedList128<T>. |
ToArray()
Creates a managed Array of T that is a copy of this FixedList128<T>.
Declaration
public T[] ToArray()
Returns
Type | Description |
---|---|
T[] |
ToNativeArray(Allocator)
Creates an unmanaged NativeArray<T> that is a copy of this FixedList128<T>.
Declaration
public NativeArray<T> ToNativeArray(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | A member of the Unity.Collections.Allocator enumeration. |
Returns
Type | Description |
---|---|
NativeArray<T> |
Operators
Equality(FixedList128<T>, FixedList128<T>)
Determines whether a FixedList128<T> and FixedList128<T> have the same value.
Declaration
public static bool operator ==(in FixedList128<T> a, in FixedList128<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for equality |
FixedList128<T> | b | The FixedList128<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList128<T>, FixedList32<T>)
Determines whether a FixedList128<T> and FixedList32<T> have the same value.
Declaration
public static bool operator ==(in FixedList128<T> a, in FixedList32<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for equality |
FixedList32<T> | b | The FixedList32<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList128<T>, FixedList4096<T>)
Determines whether a FixedList128<T> and FixedList4096<T> have the same value.
Declaration
public static bool operator ==(in FixedList128<T> a, in FixedList4096<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for equality |
FixedList4096<T> | b | The FixedList4096<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList128<T>, FixedList512<T>)
Determines whether a FixedList128<T> and FixedList512<T> have the same value.
Declaration
public static bool operator ==(in FixedList128<T> a, in FixedList512<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for equality |
FixedList512<T> | b | The FixedList512<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList128<T>, FixedList64<T>)
Determines whether a FixedList128<T> and FixedList64<T> have the same value.
Declaration
public static bool operator ==(in FixedList128<T> a, in FixedList64<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for equality |
FixedList64<T> | b | The FixedList64<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Implicit(FixedList32<T> to FixedList128<T>)
Implicitly converts a FixedList32<T> to a FixedList128<T>.
Declaration
public static implicit operator FixedList128<T>(in FixedList32<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | other | The FixedList32<T> to copy |
Returns
Type | Description |
---|---|
FixedList128<T> |
Implicit(FixedList4096<T> to FixedList128<T>)
Implicitly converts a FixedList4096<T> to a FixedList128<T>.
Declaration
public static implicit operator FixedList128<T>(in FixedList4096<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList4096<T> | other | The FixedList4096<T> to copy |
Returns
Type | Description |
---|---|
FixedList128<T> |
Implicit(FixedList512<T> to FixedList128<T>)
Implicitly converts a FixedList512<T> to a FixedList128<T>.
Declaration
public static implicit operator FixedList128<T>(in FixedList512<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList512<T> | other | The FixedList512<T> to copy |
Returns
Type | Description |
---|---|
FixedList128<T> |
Implicit(FixedList64<T> to FixedList128<T>)
Implicitly converts a FixedList64<T> to a FixedList128<T>.
Declaration
public static implicit operator FixedList128<T>(in FixedList64<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList64<T> | other | The FixedList64<T> to copy |
Returns
Type | Description |
---|---|
FixedList128<T> |
Inequality(FixedList128<T>, FixedList128<T>)
Determines whether a FixedList128<T> and FixedList128<T> have different values.
Declaration
public static bool operator !=(in FixedList128<T> a, in FixedList128<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for inequality |
FixedList128<T> | b | The FixedList128<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList128<T>, FixedList32<T>)
Determines whether a FixedList128<T> and FixedList32<T> have different values.
Declaration
public static bool operator !=(in FixedList128<T> a, in FixedList32<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for inequality |
FixedList32<T> | b | The FixedList32<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList128<T>, FixedList4096<T>)
Determines whether a FixedList128<T> and FixedList4096<T> have different values.
Declaration
public static bool operator !=(in FixedList128<T> a, in FixedList4096<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for inequality |
FixedList4096<T> | b | The FixedList4096<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList128<T>, FixedList512<T>)
Determines whether a FixedList128<T> and FixedList512<T> have different values.
Declaration
public static bool operator !=(in FixedList128<T> a, in FixedList512<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for inequality |
FixedList512<T> | b | The FixedList512<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList128<T>, FixedList64<T>)
Determines whether a FixedList128<T> and FixedList64<T> have different values.
Declaration
public static bool operator !=(in FixedList128<T> a, in FixedList64<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | a | The FixedList128<T> to compare for inequality |
FixedList64<T> | b | The FixedList64<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |