Home  |  Delphi .net Home  |  System.Collections.Stack  |  Clear Method
  
Clear  
Method  
Clear (remove) all entries from the current Stack
Stack Class
System.Collections NameSpace
NotCF1.  Procedure Clear ;
CF : Methods with this mark are Compact Framework Compatible
Description
Removes all entries from the Stack. The Count value is reset to zero.
Microsoft MSDN Links
System.Collections
System.Collections.Stack
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

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

uses
  System.Collections;

var
  MyStack : System.Collections.Stack;

begin
  // Create our Stack
  MyStack := Stack.Create;

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

  Console.WriteLine('Count    = ' + MyStack.Count.ToString);
  Console.WriteLine;
  Console.WriteLine('Clearing the Stack :');

  // Clear the Stack
  MyStack.Clear;

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

  Console.Readline;
end.
   Count    = 3
  
   Clearing the Stack :
  
   Count    = 0
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author