.NET Framework Class Library |
ConcurrentQueue<(Of <(T>)>)..::.IProducerConsumerCollection<(Of <(T>)>)..::.TryAdd Method |
ConcurrentQueue<(Of <(T>)>) Class See Also Send Feedback |
Attempts to add an object to the IProducerConsumerCollection<(Of <(T>)>).
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Private Function TryAdd ( _ item As T _ ) As Boolean Implements IProducerConsumerCollection(Of T).TryAdd |
C# |
---|
bool IProducerConsumerCollection<T>.TryAdd( T item ) |
Parameters
- item
- Type: T
The object to add to the IProducerConsumerCollection<(Of <(T>)>). The value can be a null reference (Nothing in Visual Basic) for reference types.
Return Value
true if the object was added successfully; otherwise, false.Implements
IProducerConsumerCollection<(Of <(T>)>)..::.TryAdd(T)Remarks
For ConcurrentQueue<(Of <(T>)>), this operation will always add the object to the
end of the ConcurrentQueue<(Of <(T>)>)
and return true.