Skip to content

FileInfo.ToString documentation contains incorrect guidance #9212

@ryancdotnet

Description

@ryancdotnet

On the FileInfo.ToString documentation, it mentions the following:

FileInfo.ToString Method

Definition

Returns the path as a string. Use the Name property for the full path.

(See: https://learn.microsoft.com/en-us/dotnet/api/system.io.fileinfo.tostring?view=net-6.0#definition)

What's wrong?

The guidance about using the FileInfo.Name property to get the "full path" is incorrect. FileInfo.Name will only get you the file name without parent path information. This is misleading to readers.

Proposed change

Remove this superfluous guidance, as there is a remark below this section (marked important) that details what the path returned contains, as well as mentions the alternate methods of getting at file name and path information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.IO

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions