Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
IReadOnlyDictionary<TKey,TValue>.Item[TKey] Property
Definition
- Namespace:
- System.Collections.Generic
- Assemblies:
- mscorlib.dll, System.Runtime.dll
- Assemblies:
- netstandard.dll, System.Runtime.dll
- Assembly:
- System.Runtime.dll
- Assembly:
- mscorlib.dll
- Assembly:
- netstandard.dll
- Source:
- IReadOnlyDictionary.cs
- Source:
- IReadOnlyDictionary.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the element that has the specified key in the read-only dictionary.
public:
property TValue default[TKey] { TValue get(TKey key); };
public TValue this[TKey key] { get; }
member this.Item('Key) : 'Value
Default Public ReadOnly Property Item(key As TKey) As TValue
Parameters
- key
- TKey
The key to locate.
Property Value
The element that has the specified key in the read-only dictionary.
Exceptions
key is null.
The property is retrieved and key is not found.
Remarks
This property lets you access a specific element in the collection by using the following syntax: myCollection[key] (myCollection(key) in Visual Basic).
Implementations can vary in how they determine the equality of objects: for example, the class that implements IReadOnlyDictionary<TKey,TValue> might use the Comparer<T>.Default property, or it might implement the IComparer<T> method.
Implementations can vary in whether they allow key to be null.
Applies to
Feedback
Was this page helpful?
