Class FixedCapacityStack<T>
- Namespace
- AlgorithmsSW.Stack
- Assembly
- AlgorithmsSW.dll
A stack with a fixed capacity.
[PageReference(135)]
public sealed class FixedCapacityStack<T> : IStack<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
The type of the stack's items.
- Inheritance
-
FixedCapacityStack<T>
- Implements
-
IStack<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
FixedCapacityStack(int)
public FixedCapacityStack(int capacity)
Parameters
capacity
int
Properties
Capacity
public int Capacity { get; }
Property Value
Count
public int Count { get; }
Property Value
IsEmpty
public bool IsEmpty { get; }
Property Value
IsFull
[ExerciseReference(1, 3, 1)]
public bool IsFull { get; }
Property Value
Peek
[ExerciseReference(1, 3, 7)]
public T Peek { get; }
Property Value
- T
Methods
Clear()
public void Clear()
GetEnumerator()
Returns an enumerator that iterates through the collection.
[ExerciseReference(1, 3, 50)]
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator that can be used to iterate through the collection.
Pop()
public T Pop()
Returns
- T
Push(T)
public void Push(T item)
Parameters
item
T
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.