Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ConcurrentQueue<T>::IProducerConsumerCollection<T>::TryAdd Method

.NET Framework 4.6 and 4.5

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

virtual bool TryAdd(
	T item
) sealed = IProducerConsumerCollection<T>::TryAdd


Type: T

The object to add to the System.Collections.Concurrent::IProducerConsumerCollection<T>. The value can be a null reference (Nothing in Visual Basic) for reference types.

Return Value

Type: System::Boolean
true if the object was added successfully; otherwise, false.



For ConcurrentQueue<T>, this operation will always add the object to the end of the ConcurrentQueue<T> and return true.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1
© 2015 Microsoft