ObservableHashSet<T> ObservableHashSet(Of T) Class

Definition

A hash set that implements the interfaces required for Entity Framework to use notification based change tracking for a collection navigation property.

public class ObservableHashSet<T> : ISet<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged, INotifyPropertyChanging
Public Class ObservableHashSet(Of T)
    Inherits ISet(Of T)
    Implements IReadOnlyCollection(Of T), IEnumerable(Of T), IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged, INotifyPropertyChanging

Type Parameters

T

The type of elements in the hash set.

Inheritance
System.ObjectSystem.Object
ObservableHashSet<T>ObservableHashSet(Of T)
Implements
System.Collections.Generic.IReadOnlyCollection<T>System.Collections.Generic.IReadOnlyCollection(Of T) System.Collections.Generic.IEnumerable<T>System.Collections.Generic.IEnumerable(Of T) System.Collections.IEnumerableSystem.Collections.IEnumerable

Constructors

ObservableHashSet() ObservableHashSet()

Initializes a new instance of the ObservableHashSet<T> class that is empty and uses the default equality comparer for the set type.

ObservableHashSet(IEnumerable<T>) ObservableHashSet(IEnumerable(Of T))

Initializes a new instance of the ObservableHashSet<T> class that uses the default equality comparer for the set type, contains elements copied from the specified collection, and has sufficient capacity to accommodate the number of elements copied.

ObservableHashSet(IEnumerable<T>, IEqualityComparer<T>) ObservableHashSet(IEnumerable(Of T), IEqualityComparer(Of T))

Initializes a new instance of the ObservableHashSet<T> class that uses the specified equality comparer for the set type, contains elements copied from the specified collection, and has sufficient capacity to accommodate the number of elements copied.

ObservableHashSet(IEqualityComparer<T>) ObservableHashSet(IEqualityComparer(Of T))

Initializes a new instance of the ObservableHashSet<T> class that is empty and uses the specified equality comparer for the set type.

Properties

Comparer Comparer

Gets the System.Collections.Generic.IEqualityComparer<T> object that is used to determine equality for the values in the set.

Count Count

Gets the number of elements that are contained in the hash set.

IsReadOnly IsReadOnly

Gets a value indicating whether the hash set is read-only.

Methods

Add(T) Add(T)

Adds the specified element to the hash set.

Clear() Clear()

Removes all elements from the hash set.

Contains(T) Contains(T)

Determines whether the hash set object contains the specified element.

CopyTo(T[]) CopyTo(T())

Copies the elements of the hash set to an array.

CopyTo(T[], Int32) CopyTo(T(), Int32)

Copies the elements of the hash set to an array, starting at the specified array index.

CopyTo(T[], Int32, Int32) CopyTo(T(), Int32, Int32)

Copies the specified number of elements of the hash set to an array, starting at the specified array index.

ExceptWith(IEnumerable<T>) ExceptWith(IEnumerable(Of T))

Removes all elements in the specified collection from the hash set.

GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the hash set.

IntersectWith(IEnumerable<T>) IntersectWith(IEnumerable(Of T))

Modifies the current hash set to contain only elements that are present in that object and in the specified collection.

IsProperSubsetOf(IEnumerable<T>) IsProperSubsetOf(IEnumerable(Of T))

Determines whether the hash set is a proper subset of the specified collection.

IsProperSupersetOf(IEnumerable<T>) IsProperSupersetOf(IEnumerable(Of T))

Determines whether the hash set is a proper superset of the specified collection.

IsSubsetOf(IEnumerable<T>) IsSubsetOf(IEnumerable(Of T))

Determines whether the hash set is a subset of the specified collection.

IsSupersetOf(IEnumerable<T>) IsSupersetOf(IEnumerable(Of T))

Determines whether the hash set is a superset of the specified collection.

OnCollectionChanged(NotifyCollectionChangedEventArgs) OnCollectionChanged(NotifyCollectionChangedEventArgs)

Raises the CollectionChanged event.

OnPropertyChanged(PropertyChangedEventArgs) OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event.

OnPropertyChanging(PropertyChangingEventArgs) OnPropertyChanging(PropertyChangingEventArgs)

Raises the PropertyChanging event.

Overlaps(IEnumerable<T>) Overlaps(IEnumerable(Of T))

Determines whether the current System.Collections.Generic.HashSet`1 object and a specified collection share common elements.

Remove(T) Remove(T)

Removes the specified element from the hash set.

RemoveWhere(Predicate<T>) RemoveWhere(Predicate(Of T))

Removes all elements that match the conditions defined by the specified predicate from the hash set.

SetEquals(IEnumerable<T>) SetEquals(IEnumerable(Of T))

Determines whether the hash set and the specified collection contain the same elements.

SymmetricExceptWith(IEnumerable<T>) SymmetricExceptWith(IEnumerable(Of T))

Modifies the current hash set to contain only elements that are present either in that object or in the specified collection, but not both.

ToBindingList() ToBindingList()

Returns an implementation that stays in sync with this collection.

TrimExcess() TrimExcess()

Sets the capacity of the hash set to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.

UnionWith(IEnumerable<T>) UnionWith(IEnumerable(Of T))

Modifies the hash set to contain all elements that are present in itself, the specified collection, or both.

Events

CollectionChanged CollectionChanged

Occurs when the contents of the hash set changes.

PropertyChanged PropertyChanged

Occurs when a property of this hash set (such as Count) changes.

PropertyChanging PropertyChanging

Occurs when a property of this hash set (such as Count) is changing.

Explicit Interface Implementations

ICollection<T>.Add(T) System.Collections.Generic.ICollection<T>.Add(T)
IEnumerable<T>.GetEnumerator() System.Collections.Generic.IEnumerable<T>.GetEnumerator()
IEnumerable.GetEnumerator() System.Collections.IEnumerable.GetEnumerator()

Extension Methods

Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.OrderByOrdinal<T>(System.Func<T, System.String>) Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.OrderByOrdinal(Of T)(System.Func(Of T, System.String))
Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.StructuralSequenceEqual<T>(System.Collections.Generic.IEnumerable<T>) Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.StructuralSequenceEqual(Of T)(System.Collections.Generic.IEnumerable(Of T))
Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.StartsWith<T>(System.Collections.Generic.IEnumerable<T>) Microsoft.EntityFrameworkCore.Internal.EnumerableExtensions.StartsWith(Of T)(System.Collections.Generic.IEnumerable(Of T))
Microsoft.EntityFrameworkCore.Specification.Tests.Extensions.NullChecked<TEntity>() Microsoft.EntityFrameworkCore.Specification.Tests.Extensions.NullChecked(Of TEntity)()
Microsoft.EntityFrameworkCore.Specification.Tests.Extensions.ForEach<T>(System.Action<T>) Microsoft.EntityFrameworkCore.Specification.Tests.Extensions.ForEach(Of T)(System.Action(Of T))