use Stack collection
Published: 9. October 2011 | Updated: 9. October 2011License: Microsoft Public License (MS-PL)
Categories: Collections
Tags: C# Collections
Import namespace
using System.Collections.Generic;
Code
var stack = new Stack<string>(); stack.Push("1"); stack.Push("2"); stack.Push("3"); stack.Push("4"); while (stack.Count > 0) { Console.WriteLine(stack.Pop()); }Console Output:
4
3
2
1
3
2
1
| Send us feedback about this snippet » |





