3 ms·
It's resolved at compile time. It's exactly equivalent to the literal "x", but enables refactoring tools to pick up renames, compilers to error if the name is
by ppog 12y ago
It's resolved at compile time. It's exactly equivalent to the literal "x", but enables refactoring tools to pick up renames, compilers to error if the name is typoed, etc.
- _pmf_ 12y agoI've always wondered why a feature with so much benefits and such low implementation overhead has not been implemented a long time ago.
- akoeplinger 12y agoThere are many edge cases you need to consider, so a seemingly simple language feature can become hard to get right quickly. I highly recommend reading through https://roslyn.codeplex.com/discussions/570551 https://roslyn.codeplex.com/discussions/570551 and the other four revisions of the nameof() spec, they do a very good job at explaining the tradeoffs of each design.