65
1
using System;
2
using System.Collections;
3
using System.Diagnostics;
4
5
public class SamplesStack {
6
7
public static void PrintValues( IEnumerable myCollection ) {
8
foreach ( Object obj in myCollection )
9
Console.Write( " {0}", obj );
10
Console.WriteLine();
11
}
12
13
public static void Main() {
14
15
Stopwatch sw = new Stopwatch();
16
sw.Start();
17
// Creates and initializes a new Stack.
18
Stack myStack = new Stack();
19
sw.Stop();
20
Console.WriteLine("Initialize in {0} ticks.", sw.ElapsedTicks);
21
sw.Reset();
22
sw.Start();
23
myStack.Push("Hello");
24
sw.Stop();
Cached Result