Attempts to add the specified item to the BlockingCollection<(Of <(T>)>).
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function TryAdd ( _
item As T _
) As Boolean |
C# |
---|
public bool TryAdd(
T item
) |
Parameters
- item
- Type: T
The item to be added to the collection.
Return Value
true if the
item could be added; otherwise, false.
Exceptions
Exception | Condition |
---|
System..::.InvalidOperationException | The BlockingCollection<(Of <(T>)>) has been marked
as complete with regards to additions. |
System..::.ObjectDisposedException | The BlockingCollection<(Of <(T>)>) has been disposed. |
System..::.InvalidOperationException | The underlying collection didn't accept the item. |
See Also