Export (0) Print
Expand All

KeyedCollection(Of TKey, TItem).GetKeyForItem Method

When implemented in a derived class, extracts the key from the specified element.

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

'Declaration
Protected MustOverride Function GetKeyForItem ( _
	item As TItem _
) As TKey

Parameters

item
Type: TItem
The element from which to extract the key.

Return Value

Type: TKey
The key for the specified element.

If the key in the lookup dictionary is different from the key that is embedded in item, you cannot access item by using the key returned by GetKeyForItem.

This method is an O(1) operation.

Notes for Implementers

You must override this method to provide the dictionary with a way to extract keys from items in the dictionary.

This method is called internally. It is not necessary for it to be public.

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

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

Community Additions

ADD
Show:
© 2015 Microsoft