Tries to get the value for a specified key.

C# | Visual Basic | Visual C++ |
public static TValue TryGetValue<TKey, TValue>( this IDictionary<TKey, TValue> dictionary, TKey key ) where TValue : class
<ExtensionAttribute> _ Public Shared Function TryGetValue(Of TKey, TValue As Class) ( _ dictionary As IDictionary(Of TKey, TValue), _ key As TKey _ ) As TValue
[ExtensionAttribute] public: generic<typename TKey, typename TValue> where TValue : ref class static TValue TryGetValue( IDictionary<TKey, TValue>^ dictionary, TKey key )

- TKey
- The type of the key.
- TValue
- The type of the value.

- dictionary (IDictionary<(Of <(TKey, TValue>)>))
- The dictionary.
- key (TKey)
- The key.

The value for a specified key.