AdvisableHashSet<T> Class |

PostSharp.Patterns.Model.DynamicallyAdvisableObject
PostSharp.Patterns.Collections.AdvisableHashSet<T>
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 4.3.48.0 (4.3.48.0)

[SerializableAttribute] public class AdvisableHashSet<T> : DynamicallyAdvisableObject, ISet<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IQueryInterface, ICollection
Type Parameters
- T
- The type of elements in the collection
The AdvisableHashSet<T> type exposes the following members.

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>. |

Name | Description | |
---|---|---|
![]() | Add | Adds an element to the current set and returns a value to indicate if the element was successfully added. |
![]() | AddItem |
Inserts an element into the underlying set.
|
![]() | ChangeManyItems |
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 | 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) | |
![]() | 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 | Removes all elements in the specified collection from the current set. |
![]() | ExecuteWithAdvices<TResult, TAction> |
Executes an action wrapped by all custom advices added to the current object.
(Inherited from DynamicallyAdvisableObject.) |
![]() | GetEnumerator |
Returns an enumerator that iterates through the AdvisableHashSet<T>.
|
![]() | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. (Overrides DynamicallyAdvisableObject.GetObjectData(SerializationInfo, StreamingContext).) |
![]() | IntersectWith | Modifies the current set so that it contains only elements that are also in a specified collection. |
![]() | IsProperSubsetOf | Determines whether the current set is a proper (strict) subset of a specified collection. |
![]() | IsProperSupersetOf | Determines whether the current set is a proper (strict) superset of a specified collection. |
![]() | IsSubsetOf | Determines whether a set is a subset of a specified collection. |
![]() | IsSupersetOf | Determines whether the current set is a superset of a specified collection. |
![]() | OnDeserialization | Runs when the entire object graph has been deserialized. (Overrides DynamicallyAdvisableObject.OnDeserialization(Object).) |
![]() | Overlaps | Determines whether the current set overlaps with the specified collection. |
![]() | Remove | Removes the first occurrence of a specific object from the ICollection<T>. |
![]() | RemoveItem |
Removes an element from the underlying collection.
|
![]() | RemoveWhere |
Removes all elements that match the conditions defined by the specified predicate from a HashSet<T> collection.
|
![]() | SetEquals | Determines whether the current set and the specified collection contain the same elements. |
![]() | SymmetricExceptWith | 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 | Modifies the current set so that it contains all elements that are present in the current set, in the specified collection, or in both. |

Name | Description | |
---|---|---|
![]() | QueryInterface<T> |
Gets the implementation of a specified interface for the specified object.
(Defined by QueryInterfaceExtensions.) |
![]() | ToAdvisableCollection<T> |
Converts an IEnumerable<T> into an AdvisableCollection<T>.
(Defined by Extensions.) |
![]() | ToAdvisableDictionary<T, TKey, TValue> |
Converts an IEnumerable<T> into a AdvisableDictionary<TKey, TValue> given a method returning the item key and a method returning the item value.
(Defined by Extensions.) |
![]() | ToAdvisableHashSet<T> |
Converts an IEnumerable<T> into an AdvisableHashSet<T>.
(Defined by Extensions.) |

The API of this class is compatible with the HashSet<T> class. It provides some additions but preserves the same design and naming conventions.
Classes that derive from HashSet<T> can add functionalities by overriding protected methods or by defining new public methods. New public methods wrap their logic in a call of the ExecuteWithAdvices<TResult, TAction>(ObjectAccessLevel, TAction) method, which applies boundary aspects. Public methods can access the data structure thanks to protected methods, which have a name ending in Item, for instance AddItem(T). Public methods should not use other public methods of the class, as it may cause inconsistent invocation of advises and performance issues.
