C# Class Unity.Collections.NativeList

Datei anzeigen Open project: needle-mirror/com.unity.collections Class Usage Examples

Public Methods

Method Description
Add ( ) : void

Adds an element to the list.

If the list has reached its current capacity, it copies the original, internal array to a new, larger array, and then deallocates the original.

AddNoResize ( value ) : void

Adds an element to the list.

If the list has reached its current capacity, internal array won't be resized, and exception will be thrown.

AddRangeNoResize ( NativeList list ) : void

Adds elements from a list to this list.

If the list has reached its current capacity, internal array won't be resized, and exception will be thrown.

AddRangeNoResize ( void* ptr, int length ) : void

Adds elements from a buffer to this list.

If the list has reached its current capacity, internal array won't be resized, and exception will be thrown.

GetUnsafeList ( ) : UnsafeList*

Return internal UnsafeList*

NativeList ( Allocator allocator ) : System

Constructs a new list using the specified type of memory allocation.

The list initially has a capacity of one. To avoid reallocating memory for the list, specify sufficient capacity up front.

NativeList ( int initialCapacity, Allocator allocator ) : System

Constructs a new list with the specified initial capacity and type of memory allocation.

this ( int index ) : T

Retrieve a member of the contaner by index.

Private Methods

Method Description
CreateStaticSafetyId ( ) : void
ElementAt ( int index ) : T

Initialize ( int initialCapacity, &allocator, int disposeSentinelStackDepth ) : void
NativeList ( int initialCapacity, Allocator allocator, int disposeSentinelStackDepth ) : System
New ( int initialCapacity, &allocator ) : NativeList
New ( int initialCapacity, &allocator, int disposeSentinelStackDepth ) : NativeList

Method Details

Add() public method

Adds an element to the list.
If the list has reached its current capacity, it copies the original, internal array to a new, larger array, and then deallocates the original.
public Add ( ) : void
return void

AddNoResize() public method

Adds an element to the list.
If the list has reached its current capacity, internal array won't be resized, and exception will be thrown.
public AddNoResize ( value ) : void
value The value to be added at the end of the list.
return void

AddRangeNoResize() public method

Adds elements from a list to this list.
If the list has reached its current capacity, internal array won't be resized, and exception will be thrown.
public AddRangeNoResize ( NativeList list ) : void
list NativeList Other container to copy elements from.
return void

AddRangeNoResize() public method

Adds elements from a buffer to this list.
If the list has reached its current capacity, internal array won't be resized, and exception will be thrown.
Thrown if length is negative.
public AddRangeNoResize ( void* ptr, int length ) : void
ptr void* A pointer to the buffer.
length int The number of elements to add to the list.
return void

GetUnsafeList() public method

Return internal UnsafeList*
public GetUnsafeList ( ) : UnsafeList*
return UnsafeList*

NativeList() public method

Constructs a new list using the specified type of memory allocation.
The list initially has a capacity of one. To avoid reallocating memory for the list, specify sufficient capacity up front.
public NativeList ( Allocator allocator ) : System
allocator Allocator A member of the /// [Unity.Collections.Allocator](https://docs.unity3d.com/ScriptReference/Unity.Collections.Allocator.html) enumeration.
return System

NativeList() public method

Constructs a new list with the specified initial capacity and type of memory allocation.
public NativeList ( int initialCapacity, Allocator allocator ) : System
initialCapacity int The initial capacity of the list. If the list grows larger than its capacity, /// the internal array is copied to a new, larger array.
allocator Allocator A member of the /// [Unity.Collections.Allocator](https://docs.unity3d.com/ScriptReference/Unity.Collections.Allocator.html) enumeration.
return System

this() public method

Retrieve a member of the contaner by index.
Thrown if index is negative or >= to .
public this ( int index ) : T
index int The zero-based index into the list.
return T