Class AdvisableDictionary<TKey, TValue>
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, IDynamicallyAdvisableDictionary, IDynamicallyAdvisable, IQueryInterface
Type Parameters
Name | Description |
---|---|
TKey | The type of keys in the dictionary. |
TValue | The type of values in the dictionary. |
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(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 | Gets the number of elements contained in the ICollection. |
IsReadOnly | Gets a value indicating whether the IDictionary object is read-only. |
Item[TKey] | Gets or sets the element with the specified key. |
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) | Adds an element with the provided key and value to the IDictionary<TKey,TValue>. |
AddItem(TKey, TValue) | Adds an element into the underlying dictionary. |
Clear() | Removes all elements from the IDictionary object. |
ClearItems() | Removes all keys and items from the underlying dictionary. |
ContainsKey(TKey) | Determines whether the IDictionary<TKey,TValue> contains an element with the specified key. |
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) | Populates a SerializationInfo with the data needed to serialize the target object. |
OnDeserialization(Object) | Runs when the entire object graph has been deserialized. |
Remove(TKey) | Removes the element with the specified key from the IDictionary<TKey,TValue>. |
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) | Gets the value associated with the specified key. |
Explicit Interface Implementations
Name | Description |
---|---|
IDynamicallyAdvisableDictionary.KeyType | |
IDynamicallyAdvisableDictionary.ValueType |