Add(T)
Adds a new value. If the value is already present in the collection, this method should throw, but currently does not! Instead, it returns false without replacing said item.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: Unity.Collections
- Assembly: UnityEngine.ManagedKernelModule
public bool Add(T item)
Parameters
Returns
Type | Description |
|---|---|
| bool | True if the value was not already present. |
Remarks
Prefer NativeHashSet<T>.TryAdd if your intent is to allow graceful failure, as this API will eventually become more strict (and begin to throw).