Home  |  Delphi .net Home  |  System.IO.StringReader  |  Close Method
  
Close  
Method  
Closes the StringReader
StringReader Class
System.IO NameSpace
CF1.  Procedure Close ;
CF : Methods with this mark are Compact Framework Compatible
Description
Closes the StringReader stream, calling the Dispose method to do so.
 
After closing the stream, an exception will be thrown if you try to read again.
Microsoft MSDN Links
System.IO
System.IO.StringReader
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

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

uses
  System.IO;

var
  Reader           : System.IO.StringReader;
  MultiLineString  : String;
  SingleLineString : String;

begin
  // Define our multi line string
  MultiLineString := 'Hello' + Chr(13) + Chr(10) +
                     'cruel' + Chr(13) + Chr(10) +
                     'World';

  // Create our String Reader
  Reader := System.IO.StringReader.Create(MultiLineString);

  // Read the lines from our multi line string
  repeat
    SingleLineString := Reader.ReadLine;
    Console.WriteLine(SingleLineString);
  until SingleLineString = Nil;

  // Close the reader
  Reader.Close;

  Console.Readline;
end.
   Hello
   cruel
   World
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author