Skip to content

Commit 2206694

Browse files
authored
Update file-path-formats.md
1 parent 6a8eae7 commit 2206694

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

docs/standard/io/file-path-formats.md

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -203,28 +203,7 @@ Directory.Create("TeStDiReCtOrY");
203203
```
204204
creates a directory named TeStDiReCtOrY. If you rename a directory or file to change its case, the directory or file name reflects the case of the string used when you rename it. For example, the following code renames a file named test.txt to Test.txt:
205205

206-
```csharp
207-
using System;
208-
using System.IO;
209-
210-
class Example
211-
{
212-
public static void Main()
213-
{
214-
var fi = new FileInfo(@".\test.txt");
215-
fi.MoveTo(@".\Test.txt");
216-
}
217-
}
218-
```
219-
```vb
220-
Imports System.IO
221-
222-
Module Example
223-
Public Sub Main()
224-
Dim fi As New FileInfo(".\test.txt")
225-
fi.MoveTo(".\Test.txt")
226-
End Sub
227-
End Module
228-
```
206+
[!code-csharp[case-and-renaming](~/samples/snippets/standard/io/file-names/cs/renaming.cs)]
207+
[!code-vb[case-and-renaming](~/samples/snippets/standard/io/file-names/vb/renaming.vb)]
229208

230209
However, directory and file name comparisons are case-insensitive. If you search for a file named "test.txt", .NET file system APIs ignore case in the comparison. Test.txt, TEST.TXT, test.TXT, and any other combination of upper- and lowercase letters will match "test.txt".

0 commit comments

Comments
 (0)