Struct NativeKeyValueArrays<TKey, TValue>
Key value arrays.
Namespace: Unity.Collections
Syntax
public struct NativeKeyValueArrays<TKey, TValue> : IDisposable where TKey : struct where TValue : struct
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in the container. |
TValue | The type of the values in the container. |
Constructors
NativeKeyValueArrays(Int32, Allocator, NativeArrayOptions)
NativeKeyValueArrays constructor.
Declaration
public NativeKeyValueArrays(int length, Allocator allocator, NativeArrayOptions options)
Parameters
Type | Name | Description |
---|---|---|
Int32 | length | The length of the arrays. |
Allocator | allocator | A member of the Unity.Collections.Allocator enumeration. |
NativeArrayOptions | options | Memory should be cleared on allocation or left uninitialized. |
Fields
Keys
Declaration
public NativeArray<TKey> Keys
Field Value
Type | Description |
---|---|
NativeArray<TKey> |
Values
Declaration
public NativeArray<TValue> Values
Field Value
Type | Description |
---|---|
NativeArray<TValue> |
Properties
Length
The current number of items in the container.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
Int32 | The item count. |
Methods
Dispose()
Disposes of this container and deallocates its memory immediately.
Declaration
public void Dispose()
Dispose(JobHandle)
Safely disposes of this container and deallocates its memory when the jobs that use it have completed.
Declaration
public JobHandle Dispose(JobHandle inputDeps)
Parameters
Type | Name | Description |
---|---|---|
JobHandle | inputDeps | The job handle or handles for any scheduled jobs that use this container. |
Returns
Type | Description |
---|---|
JobHandle | A new job handle containing the prior handles as well as the handle for the job that deletes the container. |
Remarks
You can call this function dispose of the container immediately after scheduling the job. Pass
the JobHandle returned by
the Job.Schedule
method using the jobHandle
parameter so the job scheduler can dispose the container after all jobs
using it have run.