Explicit this/base keywords in the nameof expression at the attribute argument
#10059
Replies: 3 comments
|
It may also feel redundant to add This "bug" did absolutely not need fixing; the specification did.. they don't make specific updates to the language because it might break existing projects, but this "fix" literally broke every single code base I have.. |
|
I agree completely, I'd really like this to be "un"-fixed |
|
are there any circumstances where 'this' is required - inside a function a local variable can shadow a member, current style recommendations are : when things are ambiguous, do we care: one of the examples at https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/this is |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The feature, which is
nameof(this.XXX), was allowed as "a bug" and has been abolished because it violates the language specification (for more details, see dotnet/roslyn#82251). I propose that this feature be restored, and thebasekeyword should also be supported in the same way.I organize the benefits and drawbacks here, including the points raised in the issue dotnet/roslyn#82251 and my points.
Benefits are:
nameof(this.XXX)again.Drawbacks are:
this/baseprefix to a member name.nameofdoes not support another disambiguity. Why should this be treated as special?All reactions