共用方式為


KeyedCollection<TKey, TItem>.RemoveItem Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Removes the element at the specified index of the KeyedCollection<TKey, TItem>.

Namespace:  System.Collections.ObjectModel
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Protected Overrides Sub RemoveItem ( _
    index As Integer _
)
protected override void RemoveItem(
    int index
)

Parameters

  • index
    Type: System.Int32
    The index of the element to remove.

Remarks

The key of the element is also removed from the lookup dictionary.

If the number of elements has exceeded the dictionary creation threshold and the KeyedCollection<TKey, TItem> is using a lookup dictionary, it will continue to use a lookup dictionary even though the number of elements is again under the threshold.

This method is an O(n) operation, where n is Count.

Notes for Implementers

Override this method to provide customized behavior for the Remove(T) and RemoveAt(Int32) methods, inherited from the Collection<T> generic class, and the Remove(TKey) method.

Call the base class implementation of this method to remove the item from the underlying collection and to update the lookup dictionary.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.