> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Class ObservableHashSet<T>

Namespace: [VM.Collections](https://developer.synopsys.com/docs/motion/motion-standalone-preprocessor-c-sharp-library/2025-r2/lib/VM.Collections)\
Assembly: VM.dll

Represents an observable set of values.

```csharp theme={null}
public sealed class ObservableHashSet<T> : HashSet<T>
```

#### Type Parameters

`T`

The type of elements in the hash set.

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[HashSet\<T>](https://learn.microsoft.com/dotnet/api/system.collections.generic.hashset-1) ←
[ObservableHashSet\<T>](https://developer.synopsys.com/docs/motion/motion-standalone-preprocessor-c-sharp-library/2025-r2/lib/VM.Collections.ObservableHashSet-1.md)

#### Extension Methods

[LinkPropertyItemCache.GetLinkProperties(object, LinkPropertyType)](https://developer.synopsys.com/docs/motion/motion-standalone-preprocessor-c-sharp-library/2025-r2/lib/VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkProperties_System_Object_VM_Models_Pre_LinkPropertyType_),
[LinkPropertyItemCache.GetLinkPropertiesAndValues(object, LinkPropertyType)](https://developer.synopsys.com/docs/motion/motion-standalone-preprocessor-c-sharp-library/2025-r2/lib/VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkPropertiesAndValues_System_Object_VM_Models_Pre_LinkPropertyType_),
[LinkPropertyItemCache.GetLinkedObjects\<T>(object, LinkPropertyType)](https://developer.synopsys.com/docs/motion/motion-standalone-preprocessor-c-sharp-library/2025-r2/lib/VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkedObjects__1_System_Object_VM_Models_Pre_LinkPropertyType_)

## Constructors

### ObservableHashSet()

```csharp theme={null}
public ObservableHashSet()
```

### ObservableHashSet(IEnumerable\<T>)

```csharp theme={null}
public ObservableHashSet(IEnumerable<T> collection)
```

#### Parameters

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

### ObservableHashSet(IEqualityComparer\<T>)

```csharp theme={null}
public ObservableHashSet(IEqualityComparer<T> comparer)
```

#### Parameters

`comparer` [IEqualityComparer](https://learn.microsoft.com/dotnet/api/system.collections.generic.iequalitycomparer-1)\<T>

### ObservableHashSet(IEnumerable\<T>, IEqualityComparer\<T>)

```csharp theme={null}
public ObservableHashSet(IEnumerable<T> collection, IEqualityComparer<T> comparer)
```

#### Parameters

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

`comparer` [IEqualityComparer](https://learn.microsoft.com/dotnet/api/system.collections.generic.iequalitycomparer-1)\<T>

## Methods

### Add(T)

Adds the specified element to a set.

```csharp theme={null}
public bool Add(T item)
```

#### Parameters

`item` T

The element to add to the set.

#### Returns

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

true if the element is added to the ObservableHashSet\`1 object; false if the element is already present.

### Clear()

Removes all elements from a ObservableHashSet\`1 object.

```csharp theme={null}
public void Clear()
```

### Dispose()

```csharp theme={null}
public void Dispose()
```

### ExceptWith(IEnumerable\<T>)

Removes all elements in the specified collection from the current ObservableHashSet\`1 object.

```csharp theme={null}
public void ExceptWith(IEnumerable<T> other)
```

#### Parameters

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

The collection of items to remove from the ObservableHashSet\`1 object.

### IntersectWith(IEnumerable\<T>)

Modifies the current ObservableHashSet\`1 object to contain only elements that are present in that object and in the specified collection.

```csharp theme={null}
public void IntersectWith(IEnumerable<T> other)
```

#### Parameters

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

The collection to compare to the current ObservableHashSet\`1 object.

### Remove(T)

Removes the specified element from a ObservableHashSet\`1 object.

```csharp theme={null}
public bool Remove(T item)
```

#### Parameters

`item` T

The element to remove.

#### Returns

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

true if the element is successfully found and removed; otherwise, false. This method returns false if item is not found in the ObservableHashSet\`1 object.

### Reset()

```csharp theme={null}
public void Reset()
```

### SymmetricExceptWith(IEnumerable\<T>)

Modifies the current ObservableHashSet\`1 object to contain only elements that are present either in that object or in the specified collection, but not both.

```csharp theme={null}
public void SymmetricExceptWith(IEnumerable<T> other)
```

#### Parameters

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

The collection to compare to the current ObservableHashSet\`1 object.

### UnionWith(IEnumerable\<T>)

Modifies the current ObservableHashSet\`1 object to contain all elements that are present in itself, the specified collection, or both.

```csharp theme={null}
public void UnionWith(IEnumerable<T> other)
```

#### Parameters

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

The collection to compare to the current ObservableHashSet\`1 object.

### CollectionChanged

```csharp theme={null}
public event NotifyCollectionChangedEventHandler CollectionChanged
```

#### Event Type

[NotifyCollectionChangedEventHandler](https://learn.microsoft.com/dotnet/api/system.collections.specialized.notifycollectionchangedeventhandler)
