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 Hierarchy
System.Object
  PostSharp.Patterns.Model.DynamicallyAdvisableObject
    PostSharp.Patterns.Collections.AdvisableDictionary<TKey, TValue>

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 4.3.31.0 (4.3.31.0)
Syntax
C#
[SerializableAttribute]
public class AdvisableDictionary<TKey, TValue> : DynamicallyAdvisableObject, 
	IQueryInterface, IDictionary, ICollection, IEnumerable, IDictionary<TKey, TValue>, 
	ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>

Type Parameters

TKey
The type of keys in the dictionary.
TValue
The type of values in the dictionary.

The AdvisableDictionary<TKey, TValue> type exposes the following members.

Constructors
  NameDescription
Public methodAdvisableDictionary<TKey, TValue>()
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.
Public methodAdvisableDictionary<TKey, TValue>(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.
Public methodAdvisableDictionary<TKey, TValue>(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.
Public methodAdvisableDictionary<TKey, TValue>(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.
Public methodAdvisableDictionary<TKey, TValue>(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 IEqualityComparer<T>.
Public methodAdvisableDictionary<TKey, TValue>(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.
Protected methodAdvisableDictionary<TKey, TValue>(SerializationInfo, StreamingContext)
Deserialization constructor.
Top
Properties
  NameDescription
Public propertyCount
Gets the number of elements contained in the ICollection.
Public propertyIsReadOnly
Gets a value indicating whether the IDictionary object is read-only.
Public propertyItem
Gets or sets the element with the specified key.
Public propertyKeys
Gets a collection containing the keys in the AdvisableDictionary<TKey, TValue>.
Public propertyValues
Gets a collection containing the values in the AdvisableDictionary<TKey, TValue>.
Top
Methods
  NameDescription
Public methodAdd
Adds an element with the provided key and value to the IDictionary<TKey, TValue>.
Protected methodAddItem
Adds an element into the underlying dictionary.
Public methodClear
Removes all elements from the IDictionary object.
Protected methodClearItems
Removes all keys and items from the underlying dictionary.
Public methodContainsKey
Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.
Public methodContainsValue
Determines whether the AdvisableDictionary<TKey, TValue> contains a specific value.
Protected methodExecuteWithAdvices<TResult, TAction>
Executes an action wrapped by all custom advices added to the current object.
(Inherited from DynamicallyAdvisableObject.)
Public methodGetEnumerator
Returns an enumerator that iterates through the AdvisableDictionary<TKey, TValue>.
Public methodGetObjectData
Populates a SerializationInfo with the data needed to serialize the target object.
(Overrides DynamicallyAdvisableObject.GetObjectData(SerializationInfo, StreamingContext).)
Public methodOnDeserialization
Runs when the entire object graph has been deserialized.
(Overrides DynamicallyAdvisableObject.OnDeserialization(Object).)
Public methodRemove
Removes the element with the specified key from the IDictionary<TKey, TValue>.
Protected methodRemoveItem
Removes the value with the specific key from the underlying dictionary.
Protected methodSetItem
Sets the value with the specified key in the underlying dictionary.
Public methodTryGetValue
Gets the value associated with the specified key.
Top
Extension Methods
  NameDescription
Public Extension MethodQueryInterface<T>
Gets the implementation of a specified interface for the specified object.
(Defined by QueryInterfaceExtensions.)
Public Extension MethodToAdvisableCollection<KeyValuePair<TKey, TValue>>
Converts an IEnumerable<T> into an AdvisableCollection<T>.
(Defined by Extensions.)
Public Extension MethodToAdvisableDictionary<KeyValuePair<TKey, TValue>, 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.)
Public Extension MethodToAdvisableHashSet<KeyValuePair<TKey, TValue>>
Converts an IEnumerable<T> into an AdvisableHashSet<T>.
(Defined by Extensions.)
Top
Remarks

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

See Also