Description |
The ToString method, inherited from System.Object is especially crucial for the StringWriter class - it is the only means of retrieving the current value of the string built by the writer so far.
The string will contain line-termination characters (such as carriage-return/line-feed, according to your platform) if the WriteLine method was used to build the string.
|
|
Microsoft MSDN Links |
System.IO
System.IO.StringWriter
|
|
|
A simple example |
program Project1;
{$APPTYPE CONSOLE}
uses
System.IO;
var
Writer : System.IO.StringWriter;
begin
// Create our String Writer
Writer := System.IO.StringWriter.Create;
// Write various things to our StringWriter
Writer.WriteLine(27);
Writer.WriteLine(true);
Writer.WriteLine(DateTime.Create(2004, 9, 17));
// Now display the contents
Console.WriteLine(Writer.ToString);
Console.Readline;
end.
| Show full unit code | 27
True
17/09/2004 00:00:00
|
|
|
|