PostSharpAPI ReferencePost­Sharp.​Patterns.​CollectionsAdvisable­Dictionary<TKey, TValue>
Open sandboxFocus

AdvisableDictionary<TKey, TValue> Class

An implementation of a Dictionary<TKey,TValue> into which advices can be injected dynamically. The class also allows derived classes to add new behaviors by overriding methods, like the Collection<T> class does.

Inheritance
AdvisableDictionary<TKey, TValue>
Implements
System.Runtime.Serialization.ISerializable
System.Runtime.Serialization.IDeserializationCallback
IDynamicallyAdvisableDictionary
IDynamicallyAdvisable
IQueryInterface
IDictionary
ICollection
System.Collections.IEnumerable
IDictionary<TKey, TValue>
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>
Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class AdvisableDictionary<TKey, TValue> : DynamicallyAdvisableObject, IDynamicallyAdvisableDictionary, IDynamicallyAdvisable, IQueryInterface
Type Parameters
Name Description
TKey

The type of keys in the dictionary.

TValue

The type of values in the dictionary.

Remarks

To learn how to extend this class, see the AdvisableCollection<T> class documentation,

Constructors

Name Description
AdvisableDictionary()

Initializes a new instance of the AdvisableDictionary<TKey, TValue> class that is empty, has the default initial capacity, and uses the default equality comparer for the key type.

AdvisableDictionary(IDictionary<TKey, TValue>)

Initializes a new instance of the AdvisableDictionary<TKey, TValue> class that contains elements copied from the specified IDictionary<TKey,TValue> and uses the default equality comparer for the key type.

AdvisableDictionary(IDictionary<TKey, TValue>, IEqualityComparer<TKey>)

Initializes a new instance of the AdvisableDictionary<TKey, TValue> class that contains elements copied from the specified IDictionary<TKey,TValue> and uses the specified System.Collections.Generic.IEqualityComparer<>.

AdvisableDictionary(IEqualityComparer<TKey>)

Initializes a new instance of the AdvisableDictionary<TKey, TValue> that is empty, has the default initial capacity, and uses the specified equality comparer for the key type.

AdvisableDictionary(Int32)

Initializes a new instance of the AdvisableDictionary<TKey, TValue> class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type.

AdvisableDictionary(Int32, IEqualityComparer<TKey>)

Initializes a new instance of the AdvisableDictionary<TKey, TValue> that is empty, has a specified initial capacity, and uses the specified equality comparer for the key type.

AdvisableDictionary(SerializationInfo, StreamingContext)

Deserialization constructor.

Properties

Name Description
Count
IsReadOnly
Item[TKey]
Keys

Gets a collection containing the keys in the AdvisableDictionary<TKey, TValue>.

Values

Gets a collection containing the values in the AdvisableDictionary<TKey, TValue>.

Methods

Name Description
Add(TKey, TValue)
AddItem(TKey, TValue)

Adds an element into the underlying dictionary.

Clear()
ClearItems()

Removes all keys and items from the underlying dictionary.

ContainsKey(TKey)
ContainsValue(TValue)

Determines whether the AdvisableDictionary<TKey, TValue> contains a specific value.

GetAdviceEnumerator()

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

GetEnumerator()

Returns an enumerator that iterates through the AdvisableDictionary<TKey, TValue>.

GetObjectData(SerializationInfo, StreamingContext)
OnDeserialization(Object)
Remove(TKey)
RemoveItem(TKey)

Removes the value with the specific key from the underlying dictionary.

SetItem(TKey, TValue, TValue)

Sets the value with the specified key in the underlying dictionary.

TryGetValue(TKey, out TValue)

Explicit Interface Implementations

Name Description
IDynamicallyAdvisableDictionary.KeyType
IDynamicallyAdvisableDictionary.ValueType