Struct NativeHashSet<T>.ReadOnly
A read-only alias for the value of a NativeHashSet. Does not have its own allocated storage.
Namespace: Unity.Collections
Assembly: Unity.Collections.dll
Syntax
[NativeContainer]
[NativeContainerIsReadOnly]
public struct NativeHashSet<T>.ReadOnly
Properties
Capacity
The number of items that fit in the current allocation.
Declaration
public readonly int Capacity { get; }
Property Value
Type | Description |
---|---|
int | The number of items that fit in the current allocation. |
Count
The current number of items in this hash set.
Declaration
public readonly int Count { get; }
Property Value
Type | Description |
---|---|
int | The current number of items in this hash set. |
IsCreated
Whether this hash set has been allocated (and not yet deallocated).
Declaration
public readonly bool IsCreated { get; }
Property Value
Type | Description |
---|---|
bool | True if this hash set has been allocated (and not yet deallocated). |
IsEmpty
Whether this hash set is empty.
Declaration
public readonly bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool | True if this hash set is empty or if the map has not been constructed. |
Methods
Contains(T)
Returns true if a given item is present in this hash set.
Declaration
public readonly bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to look up. |
Returns
Type | Description |
---|---|
bool | True if the item was present. |
GetEnumerator()
Returns an enumerator over the items of this hash set.
Declaration
public readonly NativeHashSet<T>.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
NativeHashSet<T>.Enumerator | An enumerator over the items of this hash set. |
ToNativeArray(AllocatorHandle)
Returns an array with a copy of all this hash set's items (in no particular order).
Declaration
public readonly NativeArray<T> ToNativeArray(AllocatorManager.AllocatorHandle allocator)
Parameters
Type | Name | Description |
---|---|---|
AllocatorManager.AllocatorHandle | allocator | The allocator to use. |
Returns
Type | Description |
---|---|
NativeArray<T> | An array with a copy of all this hash set's items (in no particular order). |