When passing filename parameters to procedures/functions, should I use TFilename
or String
.
If there is a difference, what is it, and what are then potential ramifications if using a String
?
e.g.
procedure TForm1.OpenFile(const AFilename : String);
begin
//Open the file if it exists
...
end;
I think TFilename
should be used when developing components because that way IDE can show it's property editor (TOpenDialog will be shown when clicked on ellipsis in the property inspector).
Other than this there is basically no difference which one to use. Remember that if you use TFilename
you must add SysUtils
to your uses clause.