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.
Implements
Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class AdvisableDictionary<TKey, TValue> : DynamicallyAdvisableObject, ISerializable, IDeserializationCallback, IDynamicallyAdvisableDictionary, IDynamicallyAdvisable, IQueryInterface, IDictionary, ICollection, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
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 IEqualityComparer<T>. |
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(int) | 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(int, 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 | |
this[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) |