Home  |  Delphi .net Home  |  System.IO.FileInfo  |  ToString Method
ToString  
Method  
Returns the current file name
FileInfo Class
System.IO NameSpace
CF1.  Function ToString ( ) : String;
CF : Methods with this mark are Compact Framework Compatible
Description
The ToString method is common to many classes - here it returns the file name as the representative string for the class.
Microsoft MSDN Links
System.IO
System.IO.FileInfo
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

var
  FileInfo : System.IO.FileInfo;

begin
  // Create a FileInfo object for a text file
  FileInfo := System.IO.FileInfo.Create('C:\DelphiBasics.txt');

  // Display the FileInfo as a string
  Console.WriteLine(FileInfo.ToString);

  Console.Readline;
end.
Show full unit code
  C:\DelphiBasics.txt
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author