UnsafeHashSet<T>
An unordered, expandable set of unique values.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Struct
- Namespace: Unity.Collections.LowLevel.Unsafe
- Assembly: UnityEngine.ManagedKernelModule
- Implements: INativeDisposable, IDisposable, IEnumerable<T>, IEnumerable
public struct UnsafeHashSet<T> : INativeDisposable, IDisposable, IEnumerable<T>, IEnumerable where T : unmanaged, IEquatable<T>
Static Fields
Value | Description |
|---|---|
| MaxCapacity | The maximum number of elements this type of container can hold. |
Constructors
Constructor | Description |
|---|---|
| UnsafeHashSet`1(System.Int32,Unity.Collections.AllocatorManager.AllocatorHandle) | Initializes and returns an instance of NativeParallelHashSet. |
Properties
Property | Description |
|---|---|
| Capacity | The number of values that fit in the current allocation. |
| Count | Returns the current number of values in this set. |
| IsCreated | Whether this set has been allocated (and not yet deallocated). |
| IsEmpty | Whether this set is empty. |
Methods
Method | Description |
|---|---|
| Add | Adds a new item. If the item is already present in the collection, this method should throw, but currently does not! Instead, it returns false without replacing said item. |
| AsReadOnly | Returns a readonly version of this UnsafeHashMap instance. |
| Clear | Removes all values. |
| Contains | Returns true if a particular value is present. |
| Dispose | Releases all resources (memory and safety handles). |
| GetEnumerator | Returns an enumerator over the values of this set. |
| Remove | Removes a particular value. |
| ToNativeArray | Returns an array with a copy of this set's values (in no particular order). |
| TrimExcess | Sets the capacity to match what it would be if it had been originally initialized with all its entries. |
| TryAdd | Attempts to add a new item. Only succeeds if the item was not present. |
Structs
Struct | Description |
|---|---|
| UnsafeHashSet<T>.Enumerator | An enumerator over the values of a set. |
| UnsafeHashSet<T>.ReadOnly | A read-only alias for the value of a UnsafeHashSet. Does not have its own allocated storage. |