Thursday 22 March 2012

Generic Stack


//Generic Stack demonstration
using System;
using System.Collections.Generic;

class Program
{
static void Main()
{
Stack<int> stackObj=new Stack<int>();

stackObj.Push(20);
stackObj.Push(30);
stackObj.Push(50);
stackObj.Push(40);
stackObj.Push(60);
stackObj.Push(80);

for(int i=0;i<stackObj.Count;i=i+0)
{
Console.WriteLine(stackObj.Pop());
}
}
}

No comments:

Post a Comment