Mono Class Library: System.Collections Namespace

System.Collections.Stack Class

A last in, first out collection of objects. [Edit]

See Also: Stack Members

[System.Runtime.InteropServices.ComVisible(true)]
public class Stack : ICollection, ICloneable

Remarks

The stack is a collection supporting only the push, pop, and peek operations. The push method puts an object onto the end of the stack. The peek method returns the most recent object placed on the stack. The pop method removes the most recent object placed on the stack and returns it.

A simple stack:
C# Example
using System;
using System.Collections;

public class SamplesStack {
                
	public static void Main (string [] args)
	{              

		Stack stack = new Stack();
		stack.Push("Hello");
		stack.Push("World");
		stack.Push("!");
		
		Console.WriteLine("the last value of the stack {0}", stack.Peek());

		stack.Pop();
		stack.Pop();

		Console.WriteLine("the last value of the stack {0}", stack.Peek());
	}
}
	

[Edit]

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0