Struct KeyValue<TKey, TValue>
A key-value pair.
Namespace: Unity.Collections.LowLevel.Unsafe
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 readonly 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 readonly KeyValue<TKey, TValue> Null { get; }
Property Value
| Type | Description |
|---|---|
| KeyValue<TKey, TValue> | In a hash map enumerator's initial state, its Unity.Collections.LowLevel.Unsafe.UnsafeHashMap`2.Enumerator.Current value is Null. |
Value
Value of key/value pair.
Declaration
public readonly 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 |
|---|---|
| Boolean | True if the key-value pair is valid. |