Struct NativeKeyValueArrays<TKey, TValue>
The keys and values of a hash map copied into two parallel arrays.
Implements
Namespace: Unity.Collections
Assembly: Unity.Collections.dll
Syntax
public struct NativeKeyValueArrays<TKey, TValue> : INativeDisposable where TKey : unmanaged where TValue : unmanaged
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys. |
TValue | The type of the values. |
Remarks
For each key-value pair copied from the hash map, the key is stored in Keys[i]
while the value is stored in Values[i]
(for the same i
).
NativeKeyValueArrays is not actually itself a native collection: it contains a NativeArray for the keys and a NativeArray for the values,
but a NativeKeyValueArrays does not have its own safety handles.
Constructors
NativeKeyValueArrays(int, AllocatorHandle, NativeArrayOptions)
Initializes and returns an instance of NativeKeyValueArrays.
Declaration
public NativeKeyValueArrays(int length, AllocatorManager.AllocatorHandle allocator, NativeArrayOptions options)
Parameters
Type | Name | Description |
---|---|---|
int | length | The number of keys-value pairs. |
AllocatorManager.AllocatorHandle | allocator | The allocator to use. |
NativeArrayOptions | options | Whether newly allocated bytes should be zeroed out. |
Fields
Keys
The keys.
Declaration
public NativeArray<TKey> Keys
Field Value
Type | Description |
---|---|
NativeArray<TKey> | The keys. The key at |
Values
The values.
Declaration
public NativeArray<TValue> Values
Field Value
Type | Description |
---|---|
NativeArray<TValue> | The values. The value at |
Properties
Length
The number of key-value pairs.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
int | The number of key-value pairs. |
Methods
Dispose()
Releases all resources (memory and safety handles).
Declaration
public void Dispose()
Dispose(JobHandle)
Creates and schedules a job that will dispose this collection's key and value arrays.
Declaration
public JobHandle Dispose(JobHandle inputDeps)
Parameters
Type | Name | Description |
---|---|---|
JobHandle | inputDeps | A job handle. The newly scheduled job will depend upon this handle. |
Returns
Type | Description |
---|---|
JobHandle | The handle of a new job that will dispose this collection's key and value arrays. |