PostSharp//API Reference/Post­Sharp.​Patterns.​Collections/Advisable­Collection<T>
Open sandboxFocus

Class AdvisableCollection<T>

A collection type similar to Collection<T> into which advices can be injected dynamically.

Namespace: PostSharp.Patterns.Collections
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class AdvisableCollection<T> : DynamicallyAdvisableObject, IDynamicallyAdvisableCollection, IDynamicallyAdvisable, IQueryInterface
Type Parameters
Name Description
T

The type of elements in the collection

Constructors

Name Description
AdvisableCollection()
AdvisableCollection(IEnumerable<T>)
AdvisableCollection(Int32)
AdvisableCollection(SerializationInfo, StreamingContext)

Properties

Name Description
Count

Gets the number of elements contained in the ICollection<T>.

IsReadOnly

Gets a value indicating whether the ICollection<T> is read-only.

Item[Int32]

Gets or sets the element at the specified index.

Methods

Name Description
Add(T)

Adds an item to the ICollection<T>.

AddRange(IEnumerable<T>)

Adds the elements of the specified collection to the end of the AdvisableCollection<T>.

Clear()

Removes all items from the ICollection<T>.

ClearItems()

Removes all elements from the underlying collection.

Contains(T)

Determines whether the ICollection<T> contains a specific value.

CopyTo(T[], Int32)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

GetAdviceEnumerator()

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

GetCount()

Gets the number of elements in the underlying collection.

GetEnumerator()

Returns an enumerator that iterates through the AdvisableCollection<T>.

GetItem(Int32)

Gets the element at the specified index of the underlying collection.

GetObjectData(SerializationInfo, StreamingContext)

Populates a SerializationInfo with the data needed to serialize the target object.

GetRange(Int32, Int32)

Creates a shallow copy of a range of elements in the source AdvisableCollection<T>.

IndexOf(T)

Determines the index of a specific item in the IList<T>.

IndexOfItem(T)

Searches for the specified object and returns the zero-based index of the first occurrence within the entire underlying collection.

Insert(Int32, T)

Inserts an item to the IList<T> at the specified index.

InsertItem(Int32, T)

Inserts an element into the underlying collection at the specified index.

InsertItems(Int32, T[])

Inserts elements into the underlying collection at the specified index.

InsertRange(Int32, IEnumerable<T>)

Inserts the elements of a collection into the AdvisableCollection<T> at the specified index.

Move(Int32, Int32)

Moved the element at the specified index to another index.

MoveItem(T, Int32, Int32)

Moves the element at the specified index to another index in the underlying collection.

OnDeserialization(Object)

Runs when the entire object graph has been deserialized.

RaiseEvents()

Raised the events that have been buffered.

Remove(T)

Removes the first occurrence of a specific object from the ICollection<T>.

RemoveAt(Int32)

Removes the IList<T> item at the specified index.

RemoveItem(Int32)

Removes the element at the specified index of the underlying collection.

RemoveItems(Int32, Int32)

Removes the specified number of elements starting at the specified index of the underlying collection.

RemoveRange(Int32, Int32)

Removes a range of elements from the AdvisableCollection<T>.

SetItem(Int32, T)

Replaces the element at the specified index of the underlying collection.

ToArray()

Creates an array from the current AdvisableCollection<T>.

Events

Name Description
CollectionChanged

Occurs when the collection changes.

PropertyChanged

Event raised when the value of a property of the current object changes.

Explicit Interface Implementations

Name Description
IDynamicallyAdvisableCollection.ItemType