KeyedCollection<TKey, TItem>.Item Property (TKey)
Gets the element with the specified key.
Assembly: mscorlib (in mscorlib.dll)
This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[key] (myCollection(key) in Visual Basic).
This property is distinct from the inherited Collection<T>.Item property, which gets and sets elements by numeric index. However, if TKey is of type Int32, this property masks the inherited property. In that case, you can access the inherited property by casting the KeyedCollection<TKey, TItem> to its base type. For example, KeyedCollection<int, MyType> (KeyedCollection(Of Integer, MyType) in Visual Basic, KeyedCollection<int, MyType^> in C++) can be cast to Collection<MyType> (Collection(Of MyType) in Visual Basic, Collection<MyType^> in C++).
If the KeyedCollection<TKey, TItem> has a lookup dictionary, key is used to retrieve the element from the dictionary. If there is no lookup dictionary, the key of each element is extracted using the GetKeyForItem method and compared with the specified key.
The C# language uses the this keyword to define the indexers instead of implementing the Item property. Visual Basic implements Item as a default property, which provides the same indexing functionality.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.