Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ConcurrentDictionary<TKey, TValue>::TryRemove Method (TKey, TValue%)

.NET Framework (current version)
 

Attempts to remove and return the value that has the specified key from the System.Collections.Concurrent::ConcurrentDictionary<TKey, TValue>.

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

public:
bool TryRemove(
	TKey key,
	[OutAttribute] TValue% value
)

Parameters

key
Type: TKey

The key of the element to remove and return.

value
Type: TValue%

When this method returns, contains the object removed from the System.Collections.Concurrent::ConcurrentDictionary<TKey, TValue>, or the default value of the TValue type if key does not exist.

Return Value

Type: System::Boolean

true if the object was removed successfully; otherwise, false.

Exception Condition
ArgumentNullException

key is null.

The following example shows how to call the ConcurrentDictionary<TKey, TValue>::TryRemove method:

No code example is currently available or this language may not be supported.

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
Show:
© 2017 Microsoft