Home  |  Delphi .net Home  |  System.Collections.Queue  |  Contains Method
  
Contains  
Method  
Returns true if the current Queue contains the given Value
Queue Class
System.Collections NameSpace
CF1.  Function Contains ( Value : Object ) : Boolean;
CF : Methods with this mark are Compact Framework Compatible
Description
The Contains method searches the current Queue for an entry matching Value, returning true if found, otherwise false.
Microsoft MSDN Links
System.Collections
System.Collections.Queue
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.Collections;

var
  MyQueue    : System.Collections.Queue;
  Enumerator : IEnumerator;

begin
  // Create our queue
  MyQueue := Queue.Create;

  // Add entries to the queue
  MyQueue.EnQueue('First');
  MyQueue.EnQueue('Second');
  MyQueue.Enqueue('Third');

  // Display the queue
  Enumerator := MyQueue.GetEnumerator;
  while enumerator.MoveNext do
    Console.WriteLine(Enumerator.Current.ToString);

  Console.WriteLine;

  if MyQueue.Contains('Second')
  then Console.WriteLine('MyQueue contains ''Second''')
  else Console.WriteLine('MyQueue does not contain ''Second''');

  if MyQueue.Contains('Fourth')
  then Console.WriteLine('MyQueue contains ''Fourth''')
  else Console.WriteLine('MyQueue does not contain ''Fourth''');

  Console.Readline;
end.
   First
   Second
   Third
  
   MyQueue contains 'Second'
   MyQueue does not contain 'Fourth'
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author