using System.Collections;
using System.Diagnostics;
public class SamplesStack {
public static void PrintValues( IEnumerable myCollection ) {
foreach ( Object obj in myCollection )
Console.Write( " {0}", obj );
public static void Main() {
Stopwatch sw = new Stopwatch();
Stack myStack = new Stack();
Console.WriteLine("Initialize in {0} ticks.", sw.ElapsedTicks);
Console.WriteLine("Push in {0} ticks.", sw.ElapsedTicks);
Console.WriteLine("Push in {0} ticks.", sw.ElapsedTicks);
Console.WriteLine("Push in {0} ticks.", sw.ElapsedTicks);
Console.WriteLine("Pop in {0} ticks.", sw.ElapsedTicks);
Console.WriteLine("Pop in {0} ticks.", sw.ElapsedTicks);
Console.WriteLine( "myStack" );
stackcnt = myStack.Count;
Console.WriteLine( "\tCount: {0}", stackcnt );
Console.WriteLine("Count in {0} ticks.", sw.ElapsedTicks);
Console.Write( "\tValues:" );