Skip to content

Commit 65adb64

Browse files
carlossanlopRon Petrusha
authored andcommitted
Add remark to Directory.Move about exception thrown in all platforms (#2358)
* Add remark to Directory.Move about exception thrown in all platforms. * Add remark to Directory.Move about exception thrown in all platforms. * Apply suggestions from code review Suggestions provided by rpetrusha. Co-Authored-By: carlossanlop <[email protected]> * Update Directory.xml Suggested by rpetrusha: - The note should be placed in the Remarks section, not the Examples section. - It would be useful to add "See the Note in the Remarks section." to line 3486.
1 parent da91ecf commit 65adb64

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

xml/System.IO/Directory.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3468,22 +3468,25 @@ Directory::CreateDirectory("Public\\Html");
34683468
Trailing spaces are removed from the end of the path parameters before moving the directory.
34693469
34703470
For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md).
3471-
3471+
3472+
3473+
> [!NOTE]
3474+
> Starting with .NET Core 3.0, the `Move` method throws an <xref:System.IO.IOException> in all platforms when the `destDirName` already exists. In .NET Core 2.2 and previous versions, the exception was only thrown on Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename).
34723475
34733476
34743477
## Examples
34753478
The following example demonstrates how to move a directory and all its files to a new directory. The original directory no longer exists after it has been moved.
34763479
34773480
[!code-csharp[System.IO.Directory#14](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class6.cs#14)]
34783481
[!code-vb[System.IO.Directory#14](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Directory/VB/class6.vb#14)]
3479-
3482+
34803483
]]></format>
34813484
</remarks>
3482-
<exception cref="T:System.IO.IOException">An attempt was made to move a directory to a different volume.
3485+
<exception cref="T:System.IO.IOException">An attempt was made to move a directory to a different volume.
34833486

34843487
-or-
34853488

3486-
<paramref name="destDirName" /> already exists.
3489+
<paramref name="destDirName" /> already exists. See the Note in the Remarks section.
34873490

34883491
-or-
34893492

@@ -4143,4 +4146,4 @@ Directory::CreateDirectory("Public\\Html");
41434146
</Docs>
41444147
</Member>
41454148
</Members>
4146-
</Type>
4149+
</Type>

0 commit comments

Comments
 (0)