Support nameof() expression #8664
Replies: 3 comments 1 reply
-
Seems like a very niche use case for a language feature considering the high cost of implementing it in the whole ecosystem. I'm pretty sure you can achieve this with Source Generators today... |
Beta Was this translation helpful? Give feedback.
-
I always wonder with these: if the variable were to be renamed, would you really want the string to change? Wouldn't that cause an incompatibility with deserialization, or something, or is there no "outside world" to worry about? Why use |
Beta Was this translation helpful? Give feedback.
-
How about |
Beta Was this translation helpful? Give feedback.
-
Sometimes we have code that looks like this:
I'm suggesting we allow this form of
nameof
in cases where the assignment target is a string variable:and so the
nameof()
is treated as if it were the explicit form, not necessarily just for declarations but in any case where we are assigning to a string variable.Beta Was this translation helpful? Give feedback.
All reactions