Stack Class

Overview

  • Last-in, First-out logic.
  • Acts as a stack of papers on a desk.

Good practice

  • When possible, use the generic version of Stack<T>

Examples

Push and Pop

Stack s = new Stack();
s.Push("Hello");
s.Push("World");
Console.WriteLine(s.Pop() + " " + s.Pop());
 
Stack<string> sg = new Stack<string>();
sg.Push("Hello");
sg.Push("World");
Console.WriteLine(sg.Pop() + " " + sg.Pop());
 
learning/exam70-536/stack.txt · Last modified: 2008/08/28 15:27 by david
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki