System.Runtime
4.0.0.0
4.0.10.0
4.0.20.0
4.1.0.0
4.2.0.0
4.2.1.0
4.2.2.0
5.0.0.0
6.0.0.0
7.0.0.0
8.0.0.0
9.0.0.0
10.0.0.0
11.0.0.0
mscorlib
2.0.5.0
4.0.0.0
netstandard
2.0.0.0
2.1.0.0
[System.Runtime.CompilerServices.Nullable(2)]
[<System.Runtime.CompilerServices.Nullable(2)>]
[System.Runtime.CompilerServices.Nullable(2)]
[<System.Runtime.CompilerServices.Nullable(2)>]
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>
System.Collections.Generic.IEnumerable<T>
System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>
System.Collections.IEnumerable
The type of keys in the read-only dictionary.
The type of values in the read-only dictionary.
Represents a generic read-only collection of key/value pairs.
object.
Each pair must have a unique key. Implementations can vary in whether they allow you to specify a key that is `null`. The value can be `null` and does not have to be unique. The interface allows the contained keys and values to be enumerated, but it does not imply any particular sort order.
The `foreach` statement of the C# language (`For Each` in Visual Basic) requires the type of each element in the collection. Because each element of the interface is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is , as the following example illustrates.
:::code language="csharp" source="~/snippets/csharp/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source2.cs" id="Snippet11":::
:::code language="vb" source="~/snippets/visualbasic/System.Collections.Generic/IDictionaryTKey,TValue/Overview/source2.vb" id="Snippet11":::
The `foreach` statement is a wrapper around the enumerator; it allows only reading from the collection, not writing to the collection.
]]>
Method
System.Runtime
4.0.0.0
4.0.10.0
4.0.20.0
4.1.0.0
4.2.0.0
4.2.1.0
4.2.2.0
5.0.0.0
6.0.0.0
7.0.0.0
8.0.0.0
9.0.0.0
10.0.0.0
11.0.0.0
mscorlib
2.0.5.0
4.0.0.0
netstandard
2.0.0.0
2.1.0.0
System.Boolean
The key to locate.
Determines whether the read-only dictionary contains an element that has the specified key.
if the read-only dictionary contains an element that has the specified key; otherwise, .
might use the property, or it might implement the method.
Implementations can vary in whether they allow `key` to be `null`.
]]>
is .
Property
System.Runtime
4.0.0.0
4.0.10.0
4.0.20.0
4.1.0.0
4.2.0.0
4.2.1.0
4.2.2.0
5.0.0.0
6.0.0.0
7.0.0.0
8.0.0.0
9.0.0.0
10.0.0.0
11.0.0.0
mscorlib
2.0.5.0
4.0.0.0
netstandard
2.0.0.0
2.1.0.0
TValue
The key to locate.
Gets the element that has the specified key in the read-only dictionary.
The element that has the specified key in the read-only dictionary.
might use the property, or it might implement the method.
Implementations can vary in whether they allow `key` to be `null`.
]]>
is .
The property is retrieved and is not found.
Property
System.Runtime
4.0.0.0
4.0.10.0
4.0.20.0
4.1.0.0
4.2.0.0
4.2.1.0
4.2.2.0
5.0.0.0
6.0.0.0
7.0.0.0
8.0.0.0
9.0.0.0
10.0.0.0
11.0.0.0
mscorlib
2.0.5.0
4.0.0.0
netstandard
2.0.0.0
2.1.0.0
System.Collections.Generic.IEnumerable<TKey>
Gets an enumerable collection that contains the keys in the read-only dictionary.
An enumerable collection that contains the keys in the read-only dictionary.
property.
]]>
Method
System.Runtime
4.0.0.0
4.0.10.0
4.0.20.0
4.1.0.0
4.2.0.0
4.2.1.0
4.2.2.0
5.0.0.0
6.0.0.0
7.0.0.0
8.0.0.0
9.0.0.0
10.0.0.0
11.0.0.0
mscorlib
2.0.5.0
4.0.0.0
netstandard
2.0.0.0
2.1.0.0
System.Boolean
[System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)]
[<System.Diagnostics.CodeAnalysis.MaybeNullWhen(false)>]
The key to locate.
When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized.
Gets the value that is associated with the specified key.
if the object that implements the interface contains an element that has the specified key; otherwise, .
method and the property.
If the key is not found, the `value` parameter gets the appropriate default value for the type `TValue`: for example, 0 (zero) for integer types, `false` for Boolean types, and `null` for reference types.
]]>
is .
Property
System.Runtime
4.0.0.0
4.0.10.0
4.0.20.0
4.1.0.0
4.2.0.0
4.2.1.0
4.2.2.0
5.0.0.0
6.0.0.0
7.0.0.0
8.0.0.0
9.0.0.0
10.0.0.0
11.0.0.0
mscorlib
2.0.5.0
4.0.0.0
netstandard
2.0.0.0
2.1.0.0
System.Collections.Generic.IEnumerable<TValue>
Gets an enumerable collection that contains the values in the read-only dictionary.
An enumerable collection that contains the values in the read-only dictionary.
property.
]]>