Partager via


ReadOnlyDictionary<TKey, TValue>.TryGetValue Method

Gets the value that is paired with the specified key and stores it in value.

Namespace:  Microsoft.TeamFoundation.Client
Assembly:  Microsoft.TeamFoundation.Client (in Microsoft.TeamFoundation.Client.dll)

Syntax

'Déclaration
Public Function TryGetValue ( _
    key As TKey, _
    <OutAttribute> ByRef value As TValue _
) As Boolean
public bool TryGetValue(
    TKey key,
    out TValue value
)
public:
virtual bool TryGetValue(
    TKey key, 
    [OutAttribute] TValue% value
) sealed
abstract TryGetValue : 
        key:'TKey * 
        value:'TValue byref -> bool 
override TryGetValue : 
        key:'TKey * 
        value:'TValue byref -> bool 
public final function TryGetValue(
    key : TKey, 
    value : TValue
) : boolean

Parameters

  • key
    Type: TKey
    The key to search for.
  • value
    Type: TValue%
    Is set to the value of the key in the dictionary if the key is in the dictionary.

Return Value

Type: System.Boolean
Returns true if thekey was in the dictionary and its value was stored in value.
False if the key was not found and itsvalue is unchanged.

Implements

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

.NET Framework Security

See Also

Reference

ReadOnlyDictionary<TKey, TValue> Class

Microsoft.TeamFoundation.Client Namespace