# NativeHashSet<T>.ReadOnly

> A read-only alias for the value of a NativeHashSet. Does not have its own allocated storage.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule
* **Implements:** [IEnumerable\<T>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable)

```csharp
public struct NativeHashSet<T>.ReadOnly : IEnumerable<T>, IEnumerable
```

## Properties

| Property                                                                                            | Description                                                         |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [Capacity](/engine/6000.7/script-reference/unity/collections/nativehashset1/readonly/capacity.md)   | The number of items that fit in the current allocation.             |
| [Count](/engine/6000.7/script-reference/unity/collections/nativehashset1/readonly/count.md)         | The current number of items in this hash set.                       |
| [IsCreated](/engine/6000.7/script-reference/unity/collections/nativehashset1/readonly/iscreated.md) | Whether this hash set has been allocated (and not yet deallocated). |
| [IsEmpty](/engine/6000.7/script-reference/unity/collections/nativehashset1/readonly/isempty.md)     | Whether this hash set is empty.                                     |

## Methods

| Method                                                                                                      | Description                                                                         |
| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [Contains](/engine/6000.7/script-reference/unity/collections/nativehashset1/readonly/contains.md)           | Returns true if a given item is present in this hash set.                           |
| [GetEnumerator](/engine/6000.7/script-reference/unity/collections/nativehashset1/readonly/getenumerator.md) | Returns an enumerator over the items of this hash set.                              |
| [ToNativeArray](/engine/6000.7/script-reference/unity/collections/nativehashset1/readonly/tonativearray.md) | Returns an array with a copy of all this hash set's items (in no particular order). |
