Skip to content

Commit 22f5509

Browse files
authored
update File.ReadAllText supported encoding in the remarks (#8562)
1 parent db8f1d7 commit 22f5509

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xml/System.IO/File.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4388,7 +4388,7 @@ The following example moves a file.
43884388
## Remarks
43894389
This method opens a file, reads all the text in the file, and returns it as a string. It then closes the file.
43904390
4391-
This method attempts to automatically detect the encoding of a file based on the presence of byte order marks. Encoding formats UTF-8 and UTF-32 (both big-endian and little-endian) can be detected.
4391+
This method attempts to automatically detect the encoding of a file based on the presence of byte order marks. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks.
43924392
43934393
Use the <xref:System.IO.File.ReadAllText%28System.String%2CSystem.Text.Encoding%29> method overload when reading files that might contain imported text, because unrecognized characters may not be read correctly.
43944394
@@ -4492,7 +4492,7 @@ The following example moves a file.
44924492
## Remarks
44934493
This method opens a file, reads all the text in the file, and returns it as a string. It then closes the file.
44944494
4495-
This method attempts to automatically detect the encoding of a file based on the presence of byte order marks. Encoding formats UTF-8 and UTF-32 (both big-endian and little-endian) can be detected.
4495+
This method attempts to automatically detect the encoding of a file based on the presence of byte order marks. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks.
44964496
44974497
The file handle is guaranteed to be closed by this method, even if exceptions are raised.
44984498

0 commit comments

Comments
 (0)