C# Stack Stack()

Description

Stack Stack() initializes a new instance of the Stack class that is empty and has the default initial capacity.

Syntax

Stack.Stack() has the following syntax.


public Stack()

Example


/* w ww.  ja v  a  2s. c  om*/
using System;
using System.Collections;
public class SamplesStack  {

   public static void Main()  {
      Stack myStack = new Stack();
      myStack.Push( "1" );

      Stack mySyncdStack = Stack.Synchronized( myStack );

      Console.WriteLine(myStack.IsSynchronized);
      Console.WriteLine(mySyncdStack.IsSynchronized);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack