Struct NativeList<T>
An unmanaged, resizable list.
Namespace: Unity.Collections
Assembly: solution.dll
Syntax
[NativeContainer]
public struct NativeList<T> : INativeDisposable, INativeList<T>, IIndexable<T> where T : unmanaged
Type Parameters
Name | Description |
---|---|
T | The type of the elements. |
Remarks
The elements are stored contiguously in a buffer rather than as linked nodes.
Constructors
Name | Description |
---|---|
Native |
Initializes and returns a NativeList. |
Native |
Initializes and returns a NativeList with a capacity of one. |
Properties
Name | Description |
---|---|
Capacity | The number of elements that fit in the current allocation. |
Is |
Whether this list has been allocated (and not yet deallocated). |
Is |
Whether this list is empty. |
this[int] | The element at a given index. |
Length | The count of elements. |
Methods
Name | Description |
---|---|
Add(in T) | Appends an element to the end of this list. |
Add |
Appends an element to the end of this list. |
Add |
Appends the elements of a buffer to the end of this list. |
Add |
Appends the elements of an array to the end of this list. |
Add |
Appends elements from a buffer to the end of this list. |
Add |
Appends the elements of another list to the end of this list. |
Add |
Appends value count times to the end of this list. |
As |
Returns a native array that aliases the content of this list. |
As |
Returns an array that aliases this list. The length of the array is updated when the length of this array is updated in a prior job. |
As |
Returns a parallel reader of this list. |
As |
Returns a parallel writer of this list. |
As |
Returns a read only of this list. |
Clear() | Sets the length to 0. |
Copy |
Copies all elements of specified container to this container. |
Copy |
Copies all elements of specified container to this container. |
Copy |
Copies all elements of specified container to this container. |
Dispose() | Releases all resources (memory and safety handles). |
Dispose(Job |
Creates and schedules a job that releases all resources (memory and safety handles) of this list. |
Element |
Returns a reference to the element at an index. |
Get |
Returns an enumerator over the elements of this list. |
Get |
Returns the internal unsafe list. |
Insert |
Shifts elements toward the end of this list, increasing its length. |
Insert |
Shifts elements toward the end of this list, increasing its length. |
Remove |
Removes the element at an index, shifting everything above it down by one. Decrements the length by 1. |
Remove |
Copies the last element of this list to the specified index. Decrements the length by 1. |
Remove |
Removes N elements in a range, shifting everything above the range down by N. Decrements the length by N. |
Remove |
Copies the last N elements of this list to a range in this list. Decrements the length by N. |
Resize(int, Native |
Sets the length of this list, increasing the capacity if necessary. |
Resize |
Sets the length of this list, increasing the capacity if necessary. |
Set |
Sets the capacity. |
To |
Returns an array containing a copy of this list's content. |
Trim |
Sets the capacity to match the length. |
Operators
Name | Description |
---|---|
implicit operator Native |
Obsolete. Use As |