FileInfo.ToString Method

Definition

Returns the original path that was passed to the FileInfo constructor. Use the FullName or Name property for the full path or file name.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Returns

A string representing the path.

Remarks

Important

The string returned by the ToString method represents the path that was passed to the FileInfo constructor. Instead of calling the ToString method, you should retrieve the value of either of the following properties, depending on your intent:

  • Name, to get the name of the file, without any parent path information.
  • FullName, to get the fully qualified path of the file.

Applies to

See also