docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct KeyValue<TKey, TValue>

    A key-value pair.

    Namespace: Unity.Collections.LowLevel.Unsafe
    Assembly: Unity.Collections.dll
    Syntax
    public struct KeyValue<TKey, TValue> where TKey : struct, IEquatable<TKey> where TValue : struct
    Type Parameters
    Name Description
    TKey

    The type of the keys.

    TValue

    The type of the values.

    Remarks

    Used for enumerators.

    Properties

    Key

    The key.

    Declaration
    public TKey Key { get; }
    Property Value
    Type Description
    TKey

    The key. If this KeyValue is Null, returns the default of TKey.

    Null

    An invalid KeyValue.

    Declaration
    public static KeyValue<TKey, TValue> Null { get; }
    Property Value
    Type Description
    KeyValue<TKey, TValue>

    In a hash map enumerator's initial state, its Current value is Null.

    Value

    Value of key/value pair.

    Declaration
    public ref TValue Value { get; }
    Property Value
    Type Description
    TValue

    Methods

    GetKeyValue(out TKey, out TValue)

    Gets the key and the value.

    Declaration
    public bool GetKeyValue(out TKey key, out TValue value)
    Parameters
    Type Name Description
    TKey key

    Outputs the key. If this KeyValue is Null, outputs the default of TKey.

    TValue value

    Outputs the value. If this KeyValue is Null, outputs the default of TValue.

    Returns
    Type Description
    bool

    True if the key-value pair is valid.

    In This Article
    • Properties
      • Key
      • Null
      • Value
    • Methods
      • GetKeyValue(out TKey, out TValue)
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)