Struct FixedListInt64
An unmanaged, resizable list of int that does not allocate memory. It is 64 bytes in size, and contains all the memory it needs.
Namespace: Unity.Collections
Syntax
public struct FixedListInt64 : 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
FixedListInt64(FixedListInt128)
Constructs a new FixedListInt64 that is a copy of a FixedListInt128.
Declaration
public FixedListInt64(in FixedListInt128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | other | The FixedListInt128 to copy |
FixedListInt64(FixedListInt32)
Constructs a new FixedListInt64 that is a copy of a FixedListInt32.
Declaration
public FixedListInt64(in FixedListInt32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt32 | other | The FixedListInt32 to copy |
FixedListInt64(FixedListInt4096)
Constructs a new FixedListInt64 that is a copy of a FixedListInt4096.
Declaration
public FixedListInt64(in FixedListInt4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt4096 | other | The FixedListInt4096 to copy |
FixedListInt64(FixedListInt512)
Constructs a new FixedListInt64 that is a copy of a FixedListInt512.
Declaration
public FixedListInt64(in FixedListInt512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt512 | other | The FixedListInt512 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 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(in 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. |
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(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 FixedListInt64.
Declaration
public bool Contains(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The object to locate in the FixedListInt64. |
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 FixedListInt64.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
FixedListInt64.Enumerator | An IEnumerator object that can be used to iterate through the container. |
GetHashCode()
Computes a hash code summary of the FixedListInt64.
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 FixedListInt64.
Declaration
public int IndexOf(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The int to locate in the FixedListInt64. |
Returns
Type | Description |
---|---|
Int32 |
Insert(Int32, Int32)
Inserts a single element into a FixedListInt64 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 FixedListInt64 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. |
Remove(Int32)
Searches for the specified int from the begining of the FixedListInt64 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 FixedListInt64 |
Returns
Type | Description |
---|---|
Boolean | Returns true if item is removed. |
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. |
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. |
RemoveSwapBack(Int32)
Removes the first occurrence of an item from the FixedListInt64 and replaces it with the last element, which can be much faster than copying down all subsequent elements.
Declaration
public bool RemoveSwapBack(int item)
Parameters
Type | Name | Description |
---|---|---|
Int32 | item | The elements to remove from the FixedListInt64. |
Returns
Type | Description |
---|---|
Boolean | Returns true if item is removed. |
Sort()
Sorts the elements in this FixedListInt64 in ascending order.
Declaration
public void Sort()
Sort<U>(U)
Sorts the elements in this FixedListInt64 using a custom comparison function.
Declaration
public void Sort<U>(U comp)
where U : IComparer<int>
Parameters
Type | Name | Description |
---|---|---|
U | comp | A comparison function that indicates whether one element in the array is less than, equal to, or greater than another element. |
Type Parameters
Name | Description |
---|---|
U | The comparer type. |
ToArray()
Creates a managed Array of int that is a copy of this FixedListInt64.
Declaration
public int[] ToArray()
Returns
Type | Description |
---|---|
Int32[] |
ToNativeArray(Allocator)
Creates an unmanaged NativeArrayint that is a copy of this FixedListInt64.
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(FixedListInt64, FixedListInt128)
Determines whether a FixedListInt64 and FixedListInt128 have the same value.
Declaration
public static bool operator ==(in FixedListInt64 a, in FixedListInt128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for equality |
FixedListInt128 | b | The FixedListInt128 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt64, FixedListInt32)
Determines whether a FixedListInt64 and FixedListInt32 have the same value.
Declaration
public static bool operator ==(in FixedListInt64 a, in FixedListInt32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for equality |
FixedListInt32 | b | The FixedListInt32 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt64, FixedListInt4096)
Determines whether a FixedListInt64 and FixedListInt4096 have the same value.
Declaration
public static bool operator ==(in FixedListInt64 a, in FixedListInt4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for equality |
FixedListInt4096 | b | The FixedListInt4096 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt64, FixedListInt512)
Determines whether a FixedListInt64 and FixedListInt512 have the same value.
Declaration
public static bool operator ==(in FixedListInt64 a, in FixedListInt512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for equality |
FixedListInt512 | b | The FixedListInt512 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Equality(FixedListInt64, FixedListInt64)
Determines whether a FixedListInt64 and FixedListInt64 have the same value.
Declaration
public static bool operator ==(in FixedListInt64 a, in FixedListInt64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for equality |
FixedListInt64 | b | The FixedListInt64 to compare for equality |
Returns
Type | Description |
---|---|
Boolean |
Implicit(FixedListInt128 to FixedListInt64)
Implicitly converts a FixedListInt128 to a FixedListInt64.
Declaration
public static implicit operator FixedListInt64(in FixedListInt128 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt128 | other | The FixedListInt128 to copy |
Returns
Type | Description |
---|---|
FixedListInt64 |
Implicit(FixedListInt32 to FixedListInt64)
Implicitly converts a FixedListInt32 to a FixedListInt64.
Declaration
public static implicit operator FixedListInt64(in FixedListInt32 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt32 | other | The FixedListInt32 to copy |
Returns
Type | Description |
---|---|
FixedListInt64 |
Implicit(FixedListInt4096 to FixedListInt64)
Implicitly converts a FixedListInt4096 to a FixedListInt64.
Declaration
public static implicit operator FixedListInt64(in FixedListInt4096 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt4096 | other | The FixedListInt4096 to copy |
Returns
Type | Description |
---|---|
FixedListInt64 |
Implicit(FixedListInt512 to FixedListInt64)
Implicitly converts a FixedListInt512 to a FixedListInt64.
Declaration
public static implicit operator FixedListInt64(in FixedListInt512 other)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt512 | other | The FixedListInt512 to copy |
Returns
Type | Description |
---|---|
FixedListInt64 |
Inequality(FixedListInt64, FixedListInt128)
Determines whether a FixedListInt64 and FixedListInt128 have different values.
Declaration
public static bool operator !=(in FixedListInt64 a, in FixedListInt128 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for inequality |
FixedListInt128 | b | The FixedListInt128 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt64, FixedListInt32)
Determines whether a FixedListInt64 and FixedListInt32 have different values.
Declaration
public static bool operator !=(in FixedListInt64 a, in FixedListInt32 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for inequality |
FixedListInt32 | b | The FixedListInt32 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt64, FixedListInt4096)
Determines whether a FixedListInt64 and FixedListInt4096 have different values.
Declaration
public static bool operator !=(in FixedListInt64 a, in FixedListInt4096 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for inequality |
FixedListInt4096 | b | The FixedListInt4096 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt64, FixedListInt512)
Determines whether a FixedListInt64 and FixedListInt512 have different values.
Declaration
public static bool operator !=(in FixedListInt64 a, in FixedListInt512 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for inequality |
FixedListInt512 | b | The FixedListInt512 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |
Inequality(FixedListInt64, FixedListInt64)
Determines whether a FixedListInt64 and FixedListInt64 have different values.
Declaration
public static bool operator !=(in FixedListInt64 a, in FixedListInt64 b)
Parameters
Type | Name | Description |
---|---|---|
FixedListInt64 | a | The FixedListInt64 to compare for inequality |
FixedListInt64 | b | The FixedListInt64 to compare for inequality |
Returns
Type | Description |
---|---|
Boolean |