Stack.Pop : Stack « System.Collections.Generic « C# / C Sharp by API






Stack.Pop

 

  
using System;  
using System.Collections.Generic;  
   
class MainClass {  
  public static void Main() {  
    Stack<string> st = new Stack<string>();  
  
    st.Push("One");  
    st.Push("Two");  
    st.Push("Three");  
    st.Push("Four");  
    st.Push("Five");  
 
    while(st.Count > 0) { 
      string str = st.Pop(); 
      Console.Write(str + " "); 
    } 
 
    Console.WriteLine();  
  }  
}

   
  








Related examples in the same category

1.new Stack()
2.Stack.Push