Class SynchronizedStack<T>
- Namespace
- Ecng.Collections
- Assembly
- Ecng.Collections.dll
Represents a synchronized stack of items.
public class SynchronizedStack<T> : SynchronizedCollection<T, StackEx<T>>, INotifyList<T>, INotifyCollection<T>, IList<T>, IList, ICollection, ISynchronizedCollection<T>, ISynchronizedCollection, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
The type of elements in the stack.
- Inheritance
-
BaseCollection<T, StackEx<T>>SynchronizedCollection<T, StackEx<T>>SynchronizedStack<T>
- Implements
-
INotifyList<T>IList<T>ICollection<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
SynchronizedStack()
Initializes a new instance of the SynchronizedStack<T> class.
public SynchronizedStack()
Methods
OnGetItem(int)
Throws a NotSupportedException as this operation is not supported for a stack.
protected override T OnGetItem(int index)
Parameters
index
intThe index of the item to retrieve.
Returns
- T
This method always throws an exception.
Exceptions
- NotSupportedException
This operation is not supported for a stack.
OnIndexOf(T)
Throws a NotSupportedException as this operation is not supported for a stack.
protected override int OnIndexOf(T item)
Parameters
item
TThe item to locate in the stack.
Returns
- int
This method always throws an exception.
Exceptions
- NotSupportedException
This operation is not supported for a stack.
OnInsert(int, T)
Throws a NotSupportedException as this operation is not supported for a stack.
protected override void OnInsert(int index, T item)
Parameters
index
intThe index at which the item should be inserted.
item
TThe item to insert.
Exceptions
- NotSupportedException
This operation is not supported for a stack.
OnRemoveAt(int)
Throws a NotSupportedException as this operation is not supported for a stack.
protected override void OnRemoveAt(int index)
Parameters
index
intThe index of the item to remove.
Exceptions
- NotSupportedException
This operation is not supported for a stack.
Peek()
Returns the object at the top of this stack without removing it.
public T Peek()
Returns
- T
The item at the top.
Pop()
Removes and returns the object at the top of this stack.
public T Pop()
Returns
- T
The item removed from the top.
Push(T)
Adds an item to the top of this stack.
public void Push(T item)
Parameters
item
TThe item to add.