TryGetValue Method

ReadOnlyDictionary(Of TKey, TValue).TryGetValue Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Retrieves the value associated with the specified key.

Namespace:  System.Collections.ObjectModel
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Function TryGetValue ( _
	key As TKey, _
	<OutAttribute> ByRef value As TValue _
) As Boolean

Parameters

key
Type: TKey
The key whose value will be retrieved.
value
Type: TValue %
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 value parameter. This parameter is passed uninitialized.

Return Value

Type: System.Boolean
true if the object that implements ReadOnlyDictionary(Of TKey, TValue) contains an element with the specified key; otherwise, false.

Implements

IDictionary(Of TKey, TValue).TryGetValue(TKey, TValue)
IReadOnlyDictionary(Of TKey, TValue).TryGetValue(TKey, TValue)

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft