Skip to content

Commit 0ed9e05

Browse files
authored
Fix API name in data string literal spec (#81422)
1 parent bb845b4 commit 0ed9e05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/features/string-literals-data-section.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ ReadOnlySpan<byte> c = "Hello."u8;
7272
string d = "Hello."; // assuming this string literal is eligible for the `ldsfld` emit strategy
7373
```
7474

75-
The initialization calls `<PrivateImplementationDetails>.BytesToString` helper which in turn calls `Encoding.UTF8.GetBytes`.
75+
The initialization calls `<PrivateImplementationDetails>.BytesToString` helper which in turn calls `Encoding.UTF8.GetString`.
7676
This is an optimization so each of the generated static constructors is slightly smaller in IL size.
7777
These size savings can add up since one class is generated per one eligible string literal.
78-
A compile-time error is reported if the `Encoding.UTF8.GetBytes` API is not available and needs to be used
78+
A compile-time error is reported if the `Encoding.UTF8.GetString` API is not available and needs to be used
7979
(the user can then either ensure the API is available or turn off the feature flag).
8080

8181
The following example demonstrates the code generated for string literal `"Hello."`.

0 commit comments

Comments
 (0)