ConcurrentDictionary<TKey, TValue>.TryGetValue Method (TKey, TValue)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Attempts to get the value associated with the specified key from the System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.

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

public bool TryGetValue(
	TKey key,
	out TValue value


Type: TKey

The key of the value to get.

Type: TValue

When this method returns, contains the object from the System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue> that has the specified key, or the default value of the type if the operation failed.

Return Value

Type: System.Boolean

true if the key was found in the System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>; otherwise, false.

Exception Condition

key is null.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top