dotnet / dotnet/dotnet-api-docs
Add clarification that FileInfo.MoveTo modifies its FullName to point to the new file
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### 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:
```cs
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
Contributor guide
Assessment
This issue has not been assessed yet.