Skip to content
Discussion options

You must be logged in to vote

What I know as the advantages to using nameof are the following:

  • Safer renames
  • Visibility in find-all-references when you want to know about all usages

These don't apply to nameof(false).

Taking advantages you listed:

  • Strong typing. I would disagree that this is strong typing, because when you want strings like false it will also offer strings like int and 123.
  • Avoiding potential typos. I would disagree that this has advantages over spell checkers, code review, unit tests, and declaring constants.
  • Avoiding the need to repeatedly declare constants in various projects, such as serializers and loggers. I would disagree that serializers and loggers should use nameof even if this feature di…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@RenderMichael
Comment options

Answer selected by RenderMichael
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants