Home  |  Delphi .net Home  |  System.IO.MemoryStream  |  Close Method
Close  
Method  
Close the current Memory stream
MemoryStream Class
System.IO NameSpace
CF1.  Procedure Close ( ) ;
CF : Methods with this mark are Compact Framework Compatible
Description
The current Memory Stream is closed (internally, Dispose is called).
Microsoft MSDN Links
System.IO
System.IO.MemoryStream
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

var
  Memory        : System.IO.MemoryStream;
  ByteAsInteger : Integer;

begin
  // Create our Memory Stream Writer
  Memory := System.IO.MemoryStream.Create;

  // Write to the stream
  Memory.WriteByte(1);
  Memory.WriteByte(2);
  Memory.WriteByte(3);

  // Position at the start of the stream
  Memory.Seek(0, SeekOrigin.Begin);

  // Now display the stream contents
  ByteAsInteger := Memory.ReadByte;

  while ByteAsInteger >= 0 do
  begin
    Console.WriteLine(ByteAsInteger.ToString);
    ByteAsInteger := Memory.ReadByte;
  end;

  // Close the stream
  Memory.Close;

  Console.Readline;
end.
Show full unit code
  1
  2
  3
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author