C# Stack Stack()

Description

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

Syntax


public Stack()

Example


using System;/*from  w  w  w.  ja v  a 2  s  .  c  o m*/
using System.Collections.Generic;

class Example
{
    public static void Main()
    {
        Stack<string> numbers = new Stack<string>();
        numbers.Push("one");
        numbers.Push("two");
        numbers.Push("three");
        numbers.Push("four");
        numbers.Push("five");

    }
}




















Home »
  C# Tutorial »
    System.Collections.Generic »




HashSet
LinkedList
LinkedListNode
List
Queue
SortedSet
Stack