KeyedCollection<TKey, TItem>.GetKeyForItem Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
When implemented in a derived class, extracts the key from the specified element.
Namespace: System.Collections.ObjectModel
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Protected MustOverride Function GetKeyForItem ( _
item As TItem _
) As TKey
protected abstract TKey GetKeyForItem(
TItem item
)
Parameters
- item
Type: TItem
The element from which to extract the key.
Return Value
Type: TKey
The key for the specified element.
Remarks
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.
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.