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

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