Struct FixedListInt128
An unmanaged, resizable list of int that does not allocate memory. It is 128 bytes in size, and contains all the memory it needs.
Namespace: Unity.Collections
Syntax
public struct FixedListInt128 : INativeList<int>, IEnumerable<int>, IEnumerable, IEquatable<FixedListInt32>, IComparable<FixedListInt32>, IEquatable<FixedListInt64>, IComparable<FixedListInt64>, IEquatable<FixedListInt128>, IComparable<FixedListInt128>, IEquatable<FixedListInt512>, IComparable<FixedListInt512>, IEquatable<FixedListInt4096>, IComparable<FixedListInt4096>
Constructors
FixedListInt128(FixedListInt32)
Constructs a new FixedListInt128 that is a copy of a FixedListInt32.
Declaration
public FixedListInt128(in FixedListInt32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt32 | other | The FixedListInt32 to copy |
FixedListInt128(FixedListInt4096)
Constructs a new FixedListInt128 that is a copy of a FixedListInt4096.
Declaration
public FixedListInt128(in FixedListInt4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt4096 | other | The FixedListInt4096 to copy |
FixedListInt128(FixedListInt512)
Constructs a new FixedListInt128 that is a copy of a FixedListInt512.
Declaration
public FixedListInt128(in FixedListInt512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt512 | other | The FixedListInt512 to copy |
FixedListInt128(FixedListInt64)
Constructs a new FixedListInt128 that is a copy of a FixedListInt64.
Declaration
public FixedListInt128(in FixedListInt64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | other | The FixedListInt64 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. |
Item[Int32]
Retrieve a member of the list by index.
Declaration
public int this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index into the list. |
Property Value
Type | Description |
---|---|
Int32 | 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(Int32)
Adds an element to the list.
Declaration
public void Add(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The int to be added at the end of the list. |
Exceptions
Type | Condition |
---|---|
IndexOutOfRangeException | Thrown if list is already full. See Capacity. |
AddNoResize(Int32)
Adds an element to the list.
Declaration
public void AddNoResize(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The int 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(FixedListInt128)
Compares this instance with a specified FixedListInt128 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListInt128.
Declaration
public int CompareTo(FixedListInt128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | other | The specified FixedListInt128 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListInt32)
Compares this instance with a specified FixedListInt32 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListInt32.
Declaration
public int CompareTo(FixedListInt32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt32 | other | The specified FixedListInt32 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListInt4096)
Compares this instance with a specified FixedListInt4096 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListInt4096.
Declaration
public int CompareTo(FixedListInt4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt4096 | other | The specified FixedListInt4096 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListInt512)
Compares this instance with a specified FixedListInt512 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListInt512.
Declaration
public int CompareTo(FixedListInt512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt512 | other | The specified FixedListInt512 to compare with |
Returns
Type | Description |
---|---|
Int32 |
CompareTo(FixedListInt64)
Compares this instance with a specified FixedListInt64 and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified FixedListInt64.
Declaration
public int CompareTo(FixedListInt64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | other | The specified FixedListInt64 to compare with |
Returns
Type | Description |
---|---|
Int32 |
Contains(Int32)
Determines whether an element is in the FixedListInt128.
Declaration
public bool Contains(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The object to locate in the FixedListInt128. |
Returns
Type | Description |
---|---|
Boolean |
ElementAt(Int32)
Declaration
public int ElementAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Int32 |
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(FixedListInt128)
Compares this instance with a specified FixedListInt128 and indicates whether this instance is equal to the specified FixedListInt128.
Declaration
public bool Equals(FixedListInt128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | other | The specified FixedListInt128 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListInt32)
Compares this instance with a specified FixedListInt32 and indicates whether this instance is equal to the specified FixedListInt32.
Declaration
public bool Equals(FixedListInt32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt32 | other | The specified FixedListInt32 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListInt4096)
Compares this instance with a specified FixedListInt4096 and indicates whether this instance is equal to the specified FixedListInt4096.
Declaration
public bool Equals(FixedListInt4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt4096 | other | The specified FixedListInt4096 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListInt512)
Compares this instance with a specified FixedListInt512 and indicates whether this instance is equal to the specified FixedListInt512.
Declaration
public bool Equals(FixedListInt512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt512 | other | The specified FixedListInt512 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
Equals(FixedListInt64)
Compares this instance with a specified FixedListInt64 and indicates whether this instance is equal to the specified FixedListInt64.
Declaration
public bool Equals(FixedListInt64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | other | The specified FixedListInt64 to compare with for equality |
Returns
Type | Description |
---|---|
Boolean |
GetEnumerator()
Returns an enumerator that iterates through a container.
Declaration
public FixedListInt128.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
FixedListInt128.Enumerator | An IEnumerator object that can be used to iterate through the container. |
GetHashCode()
Computes a hash code summary of the FixedListInt128.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
IndexOf(Int32)
Searches for the specified int and returns the zero-based index of the first occurrence within the entire FixedListInt128.
Declaration
public int IndexOf(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The int to locate in the FixedListInt128. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(Int32, Int32)
Searches for the specified int and returns the zero-based index of the first occurrence within the range of elements in the FixedListInt128 that starts at the specified index.
Declaration
public int IndexOf(int item, int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The int to locate in the FixedListInt128. |
Int32 | index | The zero-based starting index of the search. 0 (zero) is valid in an empty list. |
Returns
Type | Description |
---|---|
Int32 |
IndexOf(Int32, Int32, Int32)
Searches for the specified int and returns the zero-based index of the first occurrence within the range of elements in the FixedListInt128 that starts at the specified index and contains the specified number of elements.
Declaration
public int IndexOf(int item, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The int to locate in the FixedListInt128. |
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, Int32)
Inserts a single element into a FixedListInt128 at a specified zero-based index.
Declaration
public void Insert(int index, int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which the new element should be inserted. |
Int32 | item | The element to insert |
InsertRangeWithBeginEnd(Int32, Int32)
Inserts a number of items into a FixedListInt128 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. |
Remove(Int32)
Searches for the specified int from the begining of the FixedListInt128 forward, removes it if possible, and returns true if the int was successfully removed.
Declaration
public bool Remove(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The int to locate in the FixedListInt128 |
Returns
Type | Description |
---|---|
Boolean |
RemoveAt(Int32)
Removes the int 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 int |
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. |
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
.
RemoveSwapBack(Int32)
Removes the first occurrence of an item from the FixedListInt128 and replaces it with the last element, which can be much faster than copying down all subsequent elements.
Declaration
public void RemoveSwapBack(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The elements to remove from the FixedListInt128. |
Sort()
Sorts the elements in this FixedListInt128.
Declaration
public void Sort()
ToArray()
Creates a managed Array of int that is a copy of this FixedListInt128.
Declaration
public int[] ToArray()
Returns
Type | Description |
---|---|
Int32[] |
ToNativeArray(Allocator)
Creates an unmanaged NativeArrayint that is a copy of this FixedListInt128.
Declaration
public NativeArray<int> ToNativeArray(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | A member of the Unity.Collections.Allocator enumeration. |
Returns
Type | Description |
---|---|
NativeArray<Int32> |
Operators
Equality(FixedListInt128, FixedListInt128)
Determines whether a FixedListInt128 and FixedListInt128 have the same value.
Declaration
public static bool operator ==(in FixedListInt128 a, in FixedListInt128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for equality |
FixedListInt128 | b | The FixedListInt128 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt128, FixedListInt32)
Determines whether a FixedListInt128 and FixedListInt32 have the same value.
Declaration
public static bool operator ==(in FixedListInt128 a, in FixedListInt32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for equality |
FixedListInt32 | b | The FixedListInt32 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt128, FixedListInt4096)
Determines whether a FixedListInt128 and FixedListInt4096 have the same value.
Declaration
public static bool operator ==(in FixedListInt128 a, in FixedListInt4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for equality |
FixedListInt4096 | b | The FixedListInt4096 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt128, FixedListInt512)
Determines whether a FixedListInt128 and FixedListInt512 have the same value.
Declaration
public static bool operator ==(in FixedListInt128 a, in FixedListInt512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for equality |
FixedListInt512 | b | The FixedListInt512 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt128, FixedListInt64)
Determines whether a FixedListInt128 and FixedListInt64 have the same value.
Declaration
public static bool operator ==(in FixedListInt128 a, in FixedListInt64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for equality |
FixedListInt64 | b | The FixedListInt64 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Implicit(FixedListInt32 to FixedListInt128)
Implicitly converts a FixedListInt32 to a FixedListInt128.
Declaration
public static implicit operator FixedListInt128(in FixedListInt32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt32 | other | The FixedListInt32 to copy |
Returns
Type | Description |
---|---|
FixedListInt128 |
Implicit(FixedListInt4096 to FixedListInt128)
Implicitly converts a FixedListInt4096 to a FixedListInt128.
Declaration
public static implicit operator FixedListInt128(in FixedListInt4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt4096 | other | The FixedListInt4096 to copy |
Returns
Type | Description |
---|---|
FixedListInt128 |
Implicit(FixedListInt512 to FixedListInt128)
Implicitly converts a FixedListInt512 to a FixedListInt128.
Declaration
public static implicit operator FixedListInt128(in FixedListInt512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt512 | other | The FixedListInt512 to copy |
Returns
Type | Description |
---|---|
FixedListInt128 |
Implicit(FixedListInt64 to FixedListInt128)
Implicitly converts a FixedListInt64 to a FixedListInt128.
Declaration
public static implicit operator FixedListInt128(in FixedListInt64 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | other | The FixedListInt64 to copy |
Returns
Type | Description |
---|---|
FixedListInt128 |
Inequality(FixedListInt128, FixedListInt128)
Determines whether a FixedListInt128 and FixedListInt128 have different values.
Declaration
public static bool operator !=(in FixedListInt128 a, in FixedListInt128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for inequality |
FixedListInt128 | b | The FixedListInt128 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt128, FixedListInt32)
Determines whether a FixedListInt128 and FixedListInt32 have different values.
Declaration
public static bool operator !=(in FixedListInt128 a, in FixedListInt32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for inequality |
FixedListInt32 | b | The FixedListInt32 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt128, FixedListInt4096)
Determines whether a FixedListInt128 and FixedListInt4096 have different values.
Declaration
public static bool operator !=(in FixedListInt128 a, in FixedListInt4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for inequality |
FixedListInt4096 | b | The FixedListInt4096 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt128, FixedListInt512)
Determines whether a FixedListInt128 and FixedListInt512 have different values.
Declaration
public static bool operator !=(in FixedListInt128 a, in FixedListInt512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for inequality |
FixedListInt512 | b | The FixedListInt512 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt128, FixedListInt64)
Determines whether a FixedListInt128 and FixedListInt64 have different values.
Declaration
public static bool operator !=(in FixedListInt128 a, in FixedListInt64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | a | The FixedListInt128 to compare for inequality |
FixedListInt64 | b | The FixedListInt64 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |