Share via


ReadOnlyDictionary<TKey, TValue>.TryGetValue method

Gets the value associated with the specified key.

Namespace:  Microsoft.SharePoint.Taxonomy.Generic
Assembly:  Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)

Syntax

'Declaration
Public Function TryGetValue ( _
    key As TKey, _
    <OutAttribute> ByRef value As TValue _
) As Boolean
'Usage
Dim instance As ReadOnlyDictionary
Dim key As TKey
Dim value As TValue
Dim returnValue As Boolean

returnValue = instance.TryGetValue(key, _
    value)
public bool TryGetValue(
    TKey key,
    out TValue value
)

Parameters

  • key
    Type: TKey

    The key of the value to get

  • value
    Type: TValue

    When this method returns, it contains 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 current ReadOnlyDictionary object contains an element with the specified key; otherwise, false

Implements

IDictionary<TKey, TValue>.TryGetValue(TKey, TValue)

Exceptions

Exception Condition
ArgumentNullException

key is a a null reference (Nothing in Visual Basic) reference

See also

Reference

ReadOnlyDictionary<TKey, TValue> class

ReadOnlyDictionary<TKey, TValue> members

Microsoft.SharePoint.Taxonomy.Generic namespace