ConcurrentStack<T>.IProducerConsumerCollection<T>.TryAdd(T) Método
Definição
Tenta adicionar um objeto ao IProducerConsumerCollection<T>.Attempts to add an object to the IProducerConsumerCollection<T>.
virtual bool System.Collections.Concurrent.IProducerConsumerCollection<T>.TryAdd(T item) = System::Collections::Concurrent::IProducerConsumerCollection<T>::TryAdd;
bool IProducerConsumerCollection<T>.TryAdd (T item);
abstract member System.Collections.Concurrent.IProducerConsumerCollection<T>.TryAdd : 'T -> bool
override this.System.Collections.Concurrent.IProducerConsumerCollection<T>.TryAdd : 'T -> bool
Function TryAdd (item As T) As Boolean Implements IProducerConsumerCollection(Of T).TryAdd
Parâmetros
- item
- T
O objeto a ser adicionado ao IProducerConsumerCollection<T>.The object to add to the IProducerConsumerCollection<T>. O valor pode ser uma referência nula (Nada no Visual Basic) para tipos de referência.The value can be a null reference (Nothing in Visual Basic) for reference types.
Retornos
true se o objeto tiver sido adicionado com êxito; caso contrário, false.true if the object was added successfully; otherwise, false.
Implementações
Comentários
Para ConcurrentStack<T> , essa operação sempre irá inserir o objeto na parte superior do ConcurrentStack<T> e retornará true.For ConcurrentStack<T>, this operation will always insert the object onto the top of the ConcurrentStack<T> and return true.