What methods are available in a Stack<T> for adding and removing elements?
Follow:
Method Description
Push() Adds an element to the top
Pop() Removes and returns the top element
Peek() Returns top element without removing it
Clear(
Removes all elements
Example:
stack.Push(100); // Add
int top = stack.Pop(); // Remove and return top