> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.unity/ks.unity.ksserializablehashset-1.md).

# Class ksSerializableHashSet\<T>

Namespace: [KS.Unity](/reactor/api-reference/ks.unity.md)\
Assembly: KSUnity.dll

A hash set that implements ISerializationCallbackReceiver for serializing data.

```csharp
[Serializable]
public class ksSerializableHashSet<T> : ISet<T>, ICollection<T>, IEnumerable<T>, IEnumerable, ISerializationCallbackReceiver
```

#### Type Parameters

`T`

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† [ksSerializableHashSet\<T>](/reactor/api-reference/ks.unity/ks.unity.ksserializablehashset-1.md)

#### Implements

[ISet\<T>](https://learn.microsoft.com/dotnet/api/system.collections.generic.iset-1), [ICollection\<T>](https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1), [IEnumerable\<T>](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1), [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.ienumerable), ISerializationCallbackReceiver

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Properties

### Count <a href="#ks_unity_ksserializablehashset_1_count" id="ks_unity_ksserializablehashset_1_count"></a>

The number of items in the hash set.

```csharp
public int Count { get; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### IsReadOnly <a href="#ks_unity_ksserializablehashset_1_isreadonly" id="ks_unity_ksserializablehashset_1_isreadonly"></a>

Is the hash set read-only?

```csharp
public bool IsReadOnly { get; }
```

#### Property Value

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

## Methods

### Add(T) <a href="#ks_unity_ksserializablehashset_1_add__0" id="ks_unity_ksserializablehashset_1_add__0"></a>

Adds an item to the set.

```csharp
public bool Add(T item)
```

#### Parameters

`item` T

Item to add.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the item was added. False if it was already in the set.

### Clear() <a href="#ks_unity_ksserializablehashset_1_clear" id="ks_unity_ksserializablehashset_1_clear"></a>

Removes all items from the set.

```csharp
public void Clear()
```

### Contains(T) <a href="#ks_unity_ksserializablehashset_1_contains__0" id="ks_unity_ksserializablehashset_1_contains__0"></a>

Checks if an item is in the set.

```csharp
public bool Contains(T item)
```

#### Parameters

`item` T

Item to check for.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the item is in the set.

### CopyTo(T\[], int) <a href="#ks_unity_ksserializablehashset_1_copyto__0___system_int32" id="ks_unity_ksserializablehashset_1_copyto__0___system_int32"></a>

Copies the contents of the set to an array.

```csharp
public void CopyTo(T[] array, int arrayIndex)
```

#### Parameters

`array` T\[]

Array to copy to.

`arrayIndex` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Index to begin copying to.

### ExceptWith(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_exceptwith_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_exceptwith_system_collections_generic_ienumerable__0"></a>

Removes items in another collection from this set.

```csharp
public void ExceptWith(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to remove this set.

### GetEnumerator() <a href="#ks_unity_ksserializablehashset_1_getenumerator" id="ks_unity_ksserializablehashset_1_getenumerator"></a>

Iterates the set.

```csharp
public IEnumerator<T> GetEnumerator()
```

#### Returns

[IEnumerator](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerator-1)\<T>

Iterator

### IntersectWith(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_intersectwith_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_intersectwith_system_collections_generic_ienumerable__0"></a>

Removes items from this set that are not in another collection.

```csharp
public void IntersectWith(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to intersect with.

### IsProperSubsetOf(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_ispropersubsetof_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_ispropersubsetof_system_collections_generic_ienumerable__0"></a>

Checks if this set is a proper subset of another collection, meaning all of the items in this set are in the other collection and the other collection contains at least one item that is not in the set.

```csharp
public bool IsProperSubsetOf(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to check if is this is a proper subset of.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if this is a proper subset of the other items.

### IsProperSupersetOf(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_ispropersupersetof_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_ispropersupersetof_system_collections_generic_ienumerable__0"></a>

Checks if this set is a proper superset of another collection, meaning all of the items in the other collection are in this set and this set contains at least one item that is not in the other collection.

```csharp
public bool IsProperSupersetOf(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to check if is this is a proper superset of.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if this is a proper superset of the other items.

### IsSubsetOf(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_issubsetof_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_issubsetof_system_collections_generic_ienumerable__0"></a>

Checks if this set is a subset of another collection, meaning all of the items in this set are in the other collection.

```csharp
public bool IsSubsetOf(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to check if is this is a subset of.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if this is a subset of the other items.

### IsSupersetOf(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_issupersetof_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_issupersetof_system_collections_generic_ienumerable__0"></a>

Checks if this set is a superset of another collection, meaning all of the items in the other collection are in this set.

```csharp
public bool IsSupersetOf(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to check if is this is a superset of.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if this is a superset of the other items.

### Overlaps(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_overlaps_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_overlaps_system_collections_generic_ienumerable__0"></a>

Checks if any of the items in another collection are in this set.

```csharp
public bool Overlaps(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to check for.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if any of the items are in this set.

### Remove(T) <a href="#ks_unity_ksserializablehashset_1_remove__0" id="ks_unity_ksserializablehashset_1_remove__0"></a>

Removes an item from the set.

```csharp
public bool Remove(T item)
```

#### Parameters

`item` T

Item to remove.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if the item was removed. False if it was not in the set.

### SetEquals(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_setequals_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_setequals_system_collections_generic_ienumerable__0"></a>

Checks if this set and another collection contain all the same items.

```csharp
public bool SetEquals(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to check for.

#### Returns

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True if this set contains exactly the same items as `other`.

### SymmetricExceptWith(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_symmetricexceptwith_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_symmetricexceptwith_system_collections_generic_ienumerable__0"></a>

Remove items from this set that are in other, and adds items from other that are not in this set.

```csharp
public void SymmetricExceptWith(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Other items to symmetric except with.

### UnionWith(IEnumerable\<T>) <a href="#ks_unity_ksserializablehashset_1_unionwith_system_collections_generic_ienumerable__0" id="ks_unity_ksserializablehashset_1_unionwith_system_collections_generic_ienumerable__0"></a>

Adds items to this set.

```csharp
public void UnionWith(IEnumerable<T> other)
```

#### Parameters

`other` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)\<T>

Items to add.
