|
| .NET Framework Class Library |
| IProducerConsumerCollection<(Of <(T>)>)..::.TryAdd Method |
| IProducerConsumerCollection<(Of <(T>)>) Interface 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) |
|---|
Function TryAdd ( _ item As T _ ) As Boolean |
| C# |
|---|
bool TryAdd( T item ) |
Parameters
- item
- Type: T
The object to add to the IProducerConsumerCollection<(Of <(T>)>).
Return Value
true if the object was added successfully; otherwise, false.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentException | The item was invalid for this collection. |