Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Collections Namespace / Advisable­Keyed­Collection(TKey, TItem) Class

AdvisableKeyedCollection<TKey, TItem> Class

Provides the abstract base class for a keyed collection, similar to KeyedCollection<TKey, TItem>, into which advices can be injected dynamically.
Inheritance Hierarchy
System.Object
  PostSharp.Patterns.DynamicAdvising.DynamicallyAdvisableObject
    PostSharp.Patterns.Collections.AdvisableCollection<TItem>
      PostSharp.Patterns.Collections.AdvisableKeyedCollection<TKey, TItem>

Namespace:  PostSharp.Patterns.Collections
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.0.24.0 (6.0.24.0)
Syntax
C#
[SerializableAttribute]
public abstract class AdvisableKeyedCollection<TKey, TItem> : AdvisableCollection<TItem>

Type Parameters

TKey
The type of keys in the collection.
TItem
The type of values in the collection.

The AdvisableKeyedCollection<TKey, TItem> type exposes the following members.

Constructors
  NameDescription
Protected methodAdvisableKeyedCollection<TKey, TItem>()
Initializes a new instance of the AdvisableKeyedCollection<TKey, TItem> class that is empty and has the default initial capacity.
Protected methodAdvisableKeyedCollection<TKey, TItem>(Int32)
Initializes a new instance of the AdvisableKeyedCollection<TKey, TItem> class that is empty and has a specified initial capacity.
Protected methodAdvisableKeyedCollection<TKey, TItem>(Int32, IEqualityComparer<TKey>)
Initializes a new instance of the AdvisableKeyedCollection<TKey, TItem> class that has a specified initial capacity and a given equality comparer and uses the specified equality comparer.
Protected methodAdvisableKeyedCollection<TKey, TItem>(SerializationInfo, StreamingContext)
Deserialization constructor.
Properties
  NameDescription
Protected propertyComparer
Gets the generic equality comparer that is used to determine equality of keys in the collection.
Public propertyCount
Gets the number of elements contained in the ICollection<T>.
(Inherited from AdvisableCollection<T>.)
Public propertyIsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
(Inherited from AdvisableCollection<T>.)
Public propertyItem[Int32]
Gets or sets the element at the specified index.
(Inherited from AdvisableCollection<T>.)
Public propertyItem[TKey]
Gets or sets the element with the specified key.
Methods
  NameDescription
Public methodAdd
Adds an item to the ICollection<T>.
(Inherited from AdvisableCollection<T>.)
Public methodAddRange
Adds the elements of the specified collection to the end of the AdvisableCollection<T>.
(Inherited from AdvisableCollection<T>.)
Public methodClear
Removes all items from the ICollection<T>.
(Inherited from AdvisableCollection<T>.)
Protected methodClearItems
Removes all elements from the underlying collection.
(Overrides AdvisableCollection<T>.ClearItems().)
Public methodContains(T)
Determines whether the ICollection<T> contains a specific value.
(Inherited from AdvisableCollection<T>.)
Public methodContains(TKey)
Determines whether the collection contains an element with the specified key.
Public methodCopyTo
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
(Inherited from AdvisableCollection<T>.)
Protected methodExecuteWithAdvices<TResult, TAction>
Executes an action wrapped by all custom advices added to the current object.
(Inherited from DynamicallyAdvisableObject.)
Protected methodGetAdviceEnumerator (Inherited from AdvisableCollection<T>.)
Protected methodGetCount
Gets the number of elements in the underlying collection.
(Inherited from AdvisableCollection<T>.)
Public methodGetEnumerator
Returns an enumerator that iterates through the AdvisableCollection<T>.
(Inherited from AdvisableCollection<T>.)
Protected methodGetItem
Gets the element at the specified index of the underlying collection.
(Inherited from AdvisableCollection<T>.)
Protected methodGetKeyForItem
Extracts the key from the specified element.
Public methodGetObjectData
Populates a SerializationInfo with the data needed to serialize the target object.
(Overrides AdvisableCollection<T>.GetObjectData(SerializationInfo, StreamingContext).)
Public methodGetRange
Creates a shallow copy of a range of elements in the source AdvisableCollection<T>.
(Inherited from AdvisableCollection<T>.)
Public methodIndexOf
Determines the index of a specific item in the IList<T>.
(Inherited from AdvisableCollection<T>.)
Protected methodIndexOfItem
Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection.
(Overrides AdvisableCollection<T>.IndexOfItem(T).)
Protected methodInitializeAdvices
Initializes the list of dynamic advices.
(Inherited from DynamicallyAdvisableObject.)
Public methodInsert
Inserts an item to the IList<T> at the specified index.
(Inherited from AdvisableCollection<T>.)
Protected methodInsertItem
Inserts an element into the underlying collection at the specified index.
(Overrides AdvisableCollection<T>.InsertItem(Int32, T).)
Protected methodInsertItems
Inserts elements into the underlying collection at the specified index.
(Overrides AdvisableCollection<T>.InsertItems(Int32, T[]).)
Public methodInsertRange
Inserts the elements of a collection into the AdvisableCollection<T> at the specified index.
(Inherited from AdvisableCollection<T>.)
Public methodMove
Moved the element at the specified index to another index.
(Inherited from AdvisableCollection<T>.)
Protected methodMoveItem
Moves the element at the specified index to another index in the underlying collection.
(Overrides AdvisableCollection<T>.MoveItem(T, Int32, Int32).)
Public methodOnDeserialization
Runs when the entire object graph has been deserialized.
(Inherited from AdvisableCollection<T>.)
Protected methodRaiseEvents
Raised the events that have been buffered.
(Inherited from AdvisableCollection<T>.)
Public methodRemove
Removes the first occurrence of a specific object from the ICollection<T>.
(Inherited from AdvisableCollection<T>.)
Public methodRemoveAt
Removes the IList<T> item at the specified index.
(Inherited from AdvisableCollection<T>.)
Protected methodRemoveItem
Removes the element at the specified index of the underlying collection.
(Overrides AdvisableCollection<T>.RemoveItem(Int32).)
Protected methodRemoveItems
Removes the specified number of elements starting at the specified index of the underlying collection.
(Overrides AdvisableCollection<T>.RemoveItems(Int32, Int32).)
Public methodRemoveRange
Removes a range of elements from the AdvisableCollection<T>.
(Inherited from AdvisableCollection<T>.)
Protected methodSetItem
Replaces the element at the specified index of the underlying collection.
(Overrides AdvisableCollection<T>.SetItem(Int32, T).)
Public methodToArray
Creates an array from the current AdvisableCollection<T>.
(Inherited from AdvisableCollection<T>.)
Events
  NameDescription
Public eventCollectionChanged
Occurs when the collection changes.
(Inherited from AdvisableCollection<T>.)
Public eventPropertyChanged
Event raised when the value of a property of the current object changes.
(Inherited from AdvisableCollection<T>.)
Remarks

The API of this class is compatible with the KeyedCollection<TKey, TItem> class.

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

See Also