[Feature Request] nameof(X)u8
: Generating UTF-8 byte sequences using nameof()
#74979
Labels
Area-Language Design
Concept-API
This issue involves adding, removing, clarification, or modification of an API.
Feature Request
untriaged
Issues and PRs which have not yet been triaged by a lead
Background and Motivation
UTF-8 literals were introduced in C# 11, which has been extremely beneficial for developers performing optimizations using UTF-8 byte sequences. However, at present, it is not possible to apply
u8
tonameof()
. This proposal aims to simplify the generation of UTF-8 byte sequences in a manner that follows name changes. Additionally, it will bridge the asymmetry gap between the generation of regular strings and UTF-8 byte sequences.Proposed API
Usage Examples
Alternative Designs
If
$"nameof(X)"u8
were to be implemented, it would enable equivalent functionality. However, this would not resolve the asymmetry issue mentioned earlier.Risks
I guess it depends on being able to parse
nameof(X)u8
, but no further concerns come to mind.The text was updated successfully, but these errors were encountered: