Push and pop value in a generic Stack
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();
}
}
Output Five Four Three Two One
|
HTML code for linking to this page:
Related in same category :
-
-
|