public int size { get; set; }
public Stack() : this(100) { }
public void Push(T item) {
throw new StackOverflowException();
throw new InvalidOperationException("Stack is empty, cannot Pop");
public static void Main() {
Stack<string> StarWars = new Stack<string>();
StarWars.Push("The Phantom Menace");
StarWars.Push("Attack of the Clones");
StarWars.Push("Revenge of the Sith");
StarWars.Push("Rogue One");
StarWars.Push("A New Hope");
StarWars.Push("The Empire Strikes Back");
StarWars.Push("Return of the Jedi");
StarWars.Push("The Force Awakens");
StarWars.Push("The Last Jedi");
StarWars.Push("The Rise of Skywalker");
Console.WriteLine("Size of Stack: {0}", StarWars.size);
Console.WriteLine(StarWars.Peek());
Console.WriteLine(StarWars.Pop());
Console.WriteLine(StarWars.Pop());
Console.WriteLine(StarWars.Peek());
Console.WriteLine(StarWars.Get(5));
Console.WriteLine("Size of Stack: {0}", StarWars.size);