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.
IsEmpty
Reports whether container is empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean | True if this container empty. |
Implements
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. |
AddRange(Void*, Int32)
Adds elements from a buffer to this list.
Declaration
public void AddRange(void *ptr, int length)
Parameters
Type | Name | Description |
---|---|---|
Void* | ptr | A pointer to the buffer. |
Int32 | length | The number of elements to add to the list. |
AddRangeNoResize(Void*, Int32)
Adds elements from a buffer to this list.
Declaration
public void AddRangeNoResize(void *ptr, int length)
Parameters
Type | Name | Description |
---|---|---|
Void* | ptr | A pointer to the buffer. |
Int32 | length | The number of elements to add to the list. |
Clear()
Clears the list.
Declaration
public void Clear()
Implements
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 |
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
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 |
InsertRangeWithBeginEnd(Int32, Int32)
Inserts a number of items into a FixedList128<T> at a specified zero-based index.
Declaration
public void InsertRangeWithBeginEnd(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The zero-based index at which the new elements should be inserted. |
Int32 | end | The zero-based index just after where the elements should be removed. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if end argument is less than begin argument. |
ArgumentOutOfRangeException | Thrown if begin or end arguments are not positive or out of bounds. |
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. |
RemoveRangeSwapBackWithBeginEnd(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 RemoveRangeSwapBackWithBeginEnd(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. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if end argument is less than begin argument. |
ArgumentOutOfRangeException | Thrown if begin or end arguments are not positive or out of bounds. |
RemoveRangeWithBeginEnd(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 RemoveRangeWithBeginEnd(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 RemoveRangeSwapBackWithBeginEnd
.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if end argument is less than begin argument. |
ArgumentOutOfRangeException | Thrown if begin or end arguments are not positive or out of bounds. |
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 |