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 : unmanaged, IEquatable<TKey> where TValue : unmanaged
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. |