Clear a stack : Stack : Data Structure C# Examples


C# Examples » Data Structure » Stack »

 

Clear a stack









    
using  System;
using  System.Collections;

class  MainClass
{
    static  void  Main(string[]  args)
    {
        Stack  a  =  new  Stack(10);
        int  x  =  0;

        a.Push(x);
        x++;
        a.Push(x);
        foreach  (int  y  in  a)
        {
            Console.WriteLine(y);
        }

        a.Pop();
        a.Clear();
    }
}
    
   
  
   



Output

1
0


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» Stack