PostSharp//API Reference/Post­Sharp.​Patterns.​Collections/Advisable­Hash­Set<T>
Open sandboxFocus

Class AdvisableHashSet<T>

A collection type similar to HashSet<T> into which advices can be injected dynamically.

Inheritance
AdvisableHashSet<T>
Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class AdvisableHashSet<T> : DynamicallyAdvisableObject, IDynamicallyAdvisableHashSet, IDynamicallyAdvisable, IQueryInterface
Type Parameters
Name Description
T

The type of elements in the collection

Constructors

Name Description
AdvisableHashSet()
AdvisableHashSet(IEnumerable<T>)
AdvisableHashSet(IEnumerable<T>, IEqualityComparer<T>)
AdvisableHashSet(IEqualityComparer<T>)
AdvisableHashSet(SerializationInfo, StreamingContext)

Properties

Name Description
Comparer

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

Count

Gets the number of elements contained in the ICollection<T>.

Methods

Name Description
Add(T)

Adds an element to the current set and returns a value to indicate if the element was successfully added.

AddItem(T)

Inserts an element into the underlying set.

ChangeManyItems(IList<T>, IList<T>)

Modifies the underlying set by adding and removing the specified items.

Clear()

Removes all items from the ICollection<T>.

ClearItems()

Removes all elements from the underlying set.

Contains(T)

Determines whether the ICollection<T> contains a specific value.

CopyTo(T[])

Copies the elements of an AdvisableHashSet<T> object to an array.

CopyTo(T[], Int32)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

CopyTo(T[], Int32, Int32)

Copies the specified number of elements of an AdvisableHashSet<T> object to an array, starting at the specified array index.

CreateSetComparer()

Returns an IEqualityComparer object that can be used for equality testing of a AdvisableHashSet<T> object.

ExceptWith(IEnumerable<T>)

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

GetAdviceEnumerator()

Gets an AdviceEnumerator<T> for the ICollectionDynamicAdvice<T> interface.

GetEnumerator()

Returns an enumerator that iterates through the AdvisableHashSet<T>.

GetObjectData(SerializationInfo, StreamingContext)

Populates a SerializationInfo with the data needed to serialize the target object.

IntersectWith(IEnumerable<T>)

Modifies the current set so that it contains only elements that are also in a specified collection.

IsProperSubsetOf(IEnumerable<T>)

Determines whether the current set is a proper (strict) subset of a specified collection.

IsProperSupersetOf(IEnumerable<T>)

Determines whether the current set is a proper (strict) superset of a specified collection.

IsSubsetOf(IEnumerable<T>)

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

IsSupersetOf(IEnumerable<T>)

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

OnDeserialization(Object)

Runs when the entire object graph has been deserialized.

Overlaps(IEnumerable<T>)

Determines whether the current set overlaps with the specified collection.

Remove(T)

Removes the first occurrence of a specific object from the ICollection<T>.

RemoveItem(T)

Removes an element from the underlying collection.

RemoveWhere(Predicate<T>)

Removes all elements that match the conditions defined by the specified predicate from a HashSet<T> collection.

SetEquals(IEnumerable<T>)

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

SymmetricExceptWith(IEnumerable<T>)

Modifies the current set so that it contains only elements that are present either in the current set or in the specified collection, but not both.

TrimExcess()

Sets the capacity of a AdvisableHashSet<T> object to the actual number of elements it contains, rounded up to a nearby, implementation-specific value.

UnionWith(IEnumerable<T>)

Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both.

Explicit Interface Implementations

Name Description
IDynamicallyAdvisableHashSet.ItemType