docs.unity3d.com
    目次を表示する/隠す

    Struct NativeKeyValueArrays<TKey, TValue>

    The keys and values of a hash map copied into two parallel arrays.

    Namespace: Unity.Collections
    Syntax
    public struct NativeKeyValueArrays<TKey, TValue> : INativeDisposable, IDisposable where TKey : struct where TValue : struct
    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(Int32, AllocatorManager.AllocatorHandle, NativeArrayOptions)

    Initializes and returns an instance of NativeKeyValueArrays.

    Declaration
    public NativeKeyValueArrays(int length, AllocatorManager.AllocatorHandle allocator, NativeArrayOptions options)
    Parameters
    Type Name Description
    Int32 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 Keys[i] is paired with the value at Values[i].

    Values

    The values.

    Declaration
    public NativeArray<TValue> Values
    Field Value
    Type Description
    NativeArray<TValue>

    The values. The value at Values[i] is paired with the key at Keys[i].

    Properties

    Length

    The number of key-value pairs.

    Declaration
    public readonly int Length { get; }
    Property Value
    Type Description
    Int32

    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.

    Implements
    INativeDisposable.Dispose(JobHandle)
    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)