Add clarification that FileInfo.MoveTo modifies its FullName to point to the new file

Open Beginner friendly
#12,399 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
documentation

Research direction

Open xml/System.IO/FileInfo.xml and locate the FileInfo.MoveTo documentation. Compare the current text with the behavior described in the issue, then clarify what FullName refers to after the move. Done means the generated FileInfo API page clearly documents the resulting path and behavior.

Written by the indexing model from the issue text.

Description

area-System.IO untriaged
Type of issue

Missing information

Description

Currently it's not clear if after calling MoveTo, does the FileInfo still point to the old path or the new one. In this example:

var file = new FileInfo(@"D:\Temp\test.txt");
file.MoveTo(@"D:\Temp\test2.txt");

Console.WriteLine(file.FullName); // Now prints D:\Temp\test2.txt
Console.WriteLine(file.Exists); // Prints true still

It's quite a surprising behavior for me. I thought the FileInfo stayed the same.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.io.fileinfo?view=net-10.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.IO/FileInfo.xml

Document Version Independent Id

8ff2dee9-0ff5-4e0e-e58e-c2426ae7de11

Platform Id

7223a61b-29bf-4e03-57b1-2da74b5bf9a6

Article author

@dotnet-bot

Dominant language
C#
Stars
950
Forks
1.7k
Avg merge
3d 5h
Merged PRs (30d)
38

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/dotnet-api-docs

All issues in dotnet/dotnet-api-docs

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.