QueueCF 1.0, serializable

System.Collections (mscorlib.dll)class

This class describes a collection manipulated on a first-in, first-out basis. The newest elements are added to one end with the Enqueue( ) method, and the oldest are taken off the other end with Dequeue( ). A Queue can be constructed as an empty collection or with the elements of an existing collection. The initial capacity can also be specified, although the default for an empty queue is 32. Normally, a Queue automatically increases its capacity when new elements exceed the current capacity, using a default growth factor of 2.0. (The growth factor is multiplied by the current capacity to determine the new capacity.) You may specify your own growth factor when you specify an initial capacity for the Queue.

The Dequeue( ) method returns the element at the beginning of the Queue, and simultaneously removes it. You can get the first element without removal by using Peek( ). The contents of a Queue can be copied to an existing Array object using the CopyTo( ) method. ToArray( ) creates a new Array object with the contents of the Queue.

The Queue is not threadsafe. The Synchronize( ) method provides a wrapper for thread safety.

public class Queue : ICollection, IEnumerable, ICloneable {
// Public Constructors
   public Queue( );
   public Queue(ICollection col);
   public Queue(int capacity);
   public Queue(int capacity, float growFactor);
// Public Instance Properties
   public virtual int Count{get; }       
// implements ICollection
   public virtual bool IsSynchronized{get; }          
// implements ICollection
   public virtual object SyncRoot{get; } 
// implements ICollection
// Public Static Methods
   public static Queue Synchronized(Queue queue);
// Public Instance Methods
   public virtual void Clear( );
   public virtual object Clone( );        
// implements ICloneable
   public virtual bool Contains(object obj);
   public virtual void CopyTo(Array array, int index);
// implements ICollection
   public virtual object Dequeue( );
   public virtual void Enqueue(object obj);
   public virtual IEnumerator GetEnumerator( );        
// implements IEnumerable
   public virtual object Peek( );
   public virtual object[ ] ToArray( );
   public virtual void TrimToSize( );

    Part II: Programming with the .NET Framework
    Part IV: API Quick Reference
    Chapter 26. System