Struct UnsafeParallelHashMap<TKey, TValue>.ParallelWriter
A parallel writer for a UnsafeParallelHashMap.
Namespace: Unity.Collections.LowLevel.Unsafe
Assembly: Unity.Collections.dll
Syntax
[NativeContainerIsAtomicWriteOnly]
public struct UnsafeParallelHashMap<TKey, TValue>.ParallelWriter
Remarks
Use AsParallelWriter() to create a parallel writer for a UnsafeParallelHashMap.
Properties
Capacity
The number of key-value pairs that fit in the current allocation.
Declaration
public int Capacity { get; }
Property Value
| Type | Description |
|---|---|
| int | The number of key-value pairs that fit in the current allocation. |
Methods
TryAdd(TKey, TValue)
Adds a new key-value pair.
Declaration
public bool TryAdd(TKey key, TValue item)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key to add. |
| TValue | item | The value to add. |
Returns
| Type | Description |
|---|---|
| bool | True if the key-value pair was added. |
Remarks
If the key is already present, this method returns false without modifying the hash map.