C# Queue Count

Description

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

Syntax

Queue.Count has the following syntax.


public virtual int Count { get; }

Example


using System;/*  w w  w  .j  av a2s .c  om*/
using System.Collections;
public class SamplesQueue  {

   public static void Main()  {
      Queue myQ = new Queue();
      myQ.Enqueue( "A" );
      myQ.Enqueue( "B" );
      myQ.Enqueue( "C" );
      myQ.Enqueue( "D" );


      Console.WriteLine(myQ.Count);
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack