Skip to content

Commit e672b8c

Browse files
authored
Remove claim of atomicity from Copy
1 parent b6aa49d commit e672b8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xml/System.IO/File.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3656,7 +3656,7 @@ Note that if you attempt to replace a file by moving a file of the same name int
36563656

36573657
- In .NET Core 3.0 and later versions, you can call <xref:System.IO.File.Move(System.String,System.String,System.Boolean)> setting the parameter `overwrite` to `true`, which will replace the file if it exists.
36583658

3659-
- In all .NET versions, you can call <xref:System.IO.File.Copy(System.String,System.String,System.Boolean)> to copy with overwrite, then call `Delete` to remove the excess source file. This strategy is advisable if the file being copied is small, and you are looking for an "atomic" file operation. If you `Delete` the file first, and the system or program crashes, the destination file will no longer exist.
3659+
- In all .NET versions, you can call <xref:System.IO.File.Copy(System.String,System.String,System.Boolean)> to copy with overwrite, then call `Delete` to remove the excess source file. This strategy is not atomic, because a system or program crash during the `Copy` may leave a partially-written destination file, but it will ensure a (possibly incomplete) file always exists at the destination.
36603660

36613661
- In all .NET versions, you can call <xref:System.IO.File.Delete(System.String)> before calling `Move`, which will only delete the file if it exists.
36623662

0 commit comments

Comments
 (0)