Home  |  Delphi .net Home  |  System.Collections.Queue  |  Clear Method
Clear  
Method  
Clear (remove) all entries in the current Queue
Queue Class
System.Collections NameSpace
CF1.  Procedure Clear ( ) ;
CF : Methods with this mark are Compact Framework Compatible
Description
Removes all entries from the Queue. The Count value is reset to zero.
Microsoft MSDN Links
System.Collections
System.Collections.Queue
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.Collections;

var
  MyQueue : System.Collections.Queue;

begin
  // Create our queue
  MyQueue := Queue.Create(10);  // Start with a capacity of 10

  // Add entries to it
  MyQueue.EnQueue('Hello World');
  MyQueue.EnQueue(TObject(123));
  MyQueue.Enqueue(DateTime.Create(2004, 9, 15));

  Console.WriteLine('Count    = ' + MyQueue.Count.ToString);
  Console.WriteLine;
  Console.WriteLine('Clearing the Queue :');

  // Clear the Queue
  MyQueue.Clear;

  Console.WriteLine;
  Console.WriteLine('Count    = ' + MyQueue.Count.ToString);

  Console.Readline;
end.
Show full unit code
  Count    = 3
  
  Clearing the Queue :
  
  Count    = 0
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author