Struct FixedList32<T>
An unmanaged, resizable list that does not allocate memory. It is 32 bytes in size, and contains all the memory it needs.
Namespace: Unity.Collections
Syntax
public struct FixedList32<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
FixedList32(FixedList128<T>)
Constructs a new FixedList32<T> that is a copy of a FixedList128<T>.
Declaration
public FixedList32(in FixedList128<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | other | The FixedList128<T> to copy |
FixedList32(FixedList4096<T>)
Constructs a new FixedList32<T> that is a copy of a FixedList4096<T>.
Declaration
public FixedList32(in FixedList4096<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList4096<T> | other | The FixedList4096<T> to copy |
FixedList32(FixedList512<T>)
Constructs a new FixedList32<T> that is a copy of a FixedList512<T>.
Declaration
public FixedList32(in FixedList512<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList512<T> | other | The FixedList512<T> to copy |
FixedList32(FixedList64<T>)
Constructs a new FixedList32<T> that is a copy of a FixedList64<T>.
Declaration
public FixedList32(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; }
Property Value
Type | Description |
---|---|
Int32 | The number of items that the list can hold. |
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; }
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. |
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. |
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 FixedList32<T>.
Declaration
public bool Contains(in T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The object to locate in the FixedList32<T>. |
Returns
Type | Description |
---|---|
Boolean |
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 FixedList32<T>.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
FixedList32.Enumerator<> | An IEnumerator object that can be used to iterate through the container. |
GetHashCode()
Computes a hash code summary of the FixedList32<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 FixedList32.
Declaration
public int IndexOf(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The T to locate in the FixedList32<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 FixedList32<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 FixedList32<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 FixedList32<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 FixedList32<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 FixedList32<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 FixedList32<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 FixedList32<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 FixedList32<T> |
Returns
Type | Description |
---|---|
Boolean |
RemoveAt(Int32)
Removes the T at the specified index, and copies all subsequent elements backward to fill the hole so created.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which to remove the T |
RemoveAtSwapBack(Int32)
Removes an element from the FixedList32<T> at the specified index and replaces it with the last element, which can be much faster than copying down all subsequent elements.
Declaration
public void RemoveAtSwapBack(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the elements to remove. |
RemoveRange(Int32, Int32)
Removes a number of elements from a FixedList32<T> at a specified zero-based index.
Declaration
public void RemoveRange(int begin, int end)
Parameters
Type | Name | Description |
---|---|---|
Int32 | begin | The zero-based index at which the elements should be removed. |
Int32 | end | The zero-based index just after where the elements should be removed. |
RemoveSwapBack(T)
Removes the first occurrence of an item from the FixedList32<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 FixedList32<T>. |
ToArray()
Creates a managed Array of T that is a copy of this FixedList32<T>.
Declaration
public T[] ToArray()
Returns
Type | Description |
---|---|
T[] |
ToNativeArray(Allocator)
Creates an unmanaged NativeArray<T> that is a copy of this FixedList32<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(FixedList32<T>, FixedList128<T>)
Determines whether a FixedList32<T> and FixedList128<T> have the same value.
Declaration
public static bool operator ==(in FixedList32<T> a, in FixedList128<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for equality |
FixedList128<T> | b | The FixedList128<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList32<T>, FixedList32<T>)
Determines whether a FixedList32<T> and FixedList32<T> have the same value.
Declaration
public static bool operator ==(in FixedList32<T> a, in FixedList32<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for equality |
FixedList32<T> | b | The FixedList32<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList32<T>, FixedList4096<T>)
Determines whether a FixedList32<T> and FixedList4096<T> have the same value.
Declaration
public static bool operator ==(in FixedList32<T> a, in FixedList4096<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for equality |
FixedList4096<T> | b | The FixedList4096<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList32<T>, FixedList512<T>)
Determines whether a FixedList32<T> and FixedList512<T> have the same value.
Declaration
public static bool operator ==(in FixedList32<T> a, in FixedList512<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for equality |
FixedList512<T> | b | The FixedList512<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedList32<T>, FixedList64<T>)
Determines whether a FixedList32<T> and FixedList64<T> have the same value.
Declaration
public static bool operator ==(in FixedList32<T> a, in FixedList64<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for equality |
FixedList64<T> | b | The FixedList64<T> to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Implicit(FixedList128<T> to FixedList32<T>)
Implicitly converts a FixedList128<T> to a FixedList32<T>.
Declaration
public static implicit operator FixedList32<T>(in FixedList128<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList128<T> | other | The FixedList128<T> to copy |
Returns
Type | Description |
---|---|
FixedList32<T> |
Implicit(FixedList4096<T> to FixedList32<T>)
Implicitly converts a FixedList4096<T> to a FixedList32<T>.
Declaration
public static implicit operator FixedList32<T>(in FixedList4096<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList4096<T> | other | The FixedList4096<T> to copy |
Returns
Type | Description |
---|---|
FixedList32<T> |
Implicit(FixedList512<T> to FixedList32<T>)
Implicitly converts a FixedList512<T> to a FixedList32<T>.
Declaration
public static implicit operator FixedList32<T>(in FixedList512<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList512<T> | other | The FixedList512<T> to copy |
Returns
Type | Description |
---|---|
FixedList32<T> |
Implicit(FixedList64<T> to FixedList32<T>)
Implicitly converts a FixedList64<T> to a FixedList32<T>.
Declaration
public static implicit operator FixedList32<T>(in FixedList64<T> other)
Parameters
Type | Name | Description |
---|---|---|
FixedList64<T> | other | The FixedList64<T> to copy |
Returns
Type | Description |
---|---|
FixedList32<T> |
Inequality(FixedList32<T>, FixedList128<T>)
Determines whether a FixedList32<T> and FixedList128<T> have different values.
Declaration
public static bool operator !=(in FixedList32<T> a, in FixedList128<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for inequality |
FixedList128<T> | b | The FixedList128<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList32<T>, FixedList32<T>)
Determines whether a FixedList32<T> and FixedList32<T> have different values.
Declaration
public static bool operator !=(in FixedList32<T> a, in FixedList32<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for inequality |
FixedList32<T> | b | The FixedList32<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList32<T>, FixedList4096<T>)
Determines whether a FixedList32<T> and FixedList4096<T> have different values.
Declaration
public static bool operator !=(in FixedList32<T> a, in FixedList4096<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for inequality |
FixedList4096<T> | b | The FixedList4096<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList32<T>, FixedList512<T>)
Determines whether a FixedList32<T> and FixedList512<T> have different values.
Declaration
public static bool operator !=(in FixedList32<T> a, in FixedList512<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for inequality |
FixedList512<T> | b | The FixedList512<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedList32<T>, FixedList64<T>)
Determines whether a FixedList32<T> and FixedList64<T> have different values.
Declaration
public static bool operator !=(in FixedList32<T> a, in FixedList64<T> b)
Parameters
Type | Name | Description |
---|---|---|
FixedList32<T> | a | The FixedList32<T> to compare for inequality |
FixedList64<T> | b | The FixedList64<T> to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |