C# Stack Count

Description

Stack Count gets the number of elements contained in the Stack.

Syntax

Stack.Count has the following syntax.


public virtual int Count { get; }

Example


using System;/*from  www  . ja  v  a  2  s  .co m*/
using System.Collections;
public class SamplesStack  {

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

      Console.WriteLine(myStack.Count);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack