← Interactive API Explorer
Namespace: System.Collections.Concurrent

ConcurrentStack<T>

Represents a thread-safe last in-first out (LIFO) collection.

Properties (1)

int Count
Gets the number of elements contained in the ConcurrentStack.
Value: The number of elements contained in the ConcurrentStack.

Methods (2)

void Push(T)
Inserts an object at the top of the ConcurrentStack.
ParameterDescription
itemThe object to push onto the ConcurrentStack. The value can be a null reference (Nothing in Visual Basic) for reference types.
bool TryPop(T@)
Attempts to pop and return the object at the top of the ConcurrentStack.
ParameterDescription
resultWhen this method returns, if the operation was successful, result contains the object removed. If no object was available to be removed, the value is unspecified.
Returns: true if an element was removed and returned from the top of the ConcurrentStack successfully; otherwise, false.