Open
Description
- Proposal addedDiscussed in LDM 2019-02-27Decision in LDMFinalized (done, rejected, inactive)Spec'ed
See dotnet/roslyn#32472
See dotnet/roslyn#32571
LDM history:
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
YairHalberstadt commentedon Jan 17, 2019
It would have to be decided whether it would be an error to obsolete all the accessors in a property, as the property should be obsoleted instead.
I would suggest for consistency the design should follow that of VB which already allows the obsolete attribute on getters and setters.
VB allows all accessors ina property to be declared obsolete. It also allows usages of nameof on a property where all accessors have been declared obsolete.
This also avoids needing to special case the obsolete attribute, as any other attribute which is valid on both methods and properties can be applied to all accessors of a property at once.
scalablecory commentedon Jan 26, 2019
I found myself wishing for this just a few weeks ago, when trying to clean up some code that used a bunch of get/set properties to one that was a more read-only ctor-initialized record.
YairHalberstadt commentedon Mar 11, 2019
https://github.com/dotnet/csharplang/blob/master/meetings/2019/LDM-2019-02-27.md
It looks like the LDC has supported this proposal.
A prototype exists at dotnet/roslyn#32571
YairHalberstadt commentedon Mar 13, 2019
I think that obsolete should be disallowed on event accessors since it is meaningless to make add but not remove (or the other way round) obsolete.
jcouv commentedon Apr 2, 2019
Merged the feature for dev16.1 preview2 (dotnet/roslyn#32571). Thanks @YairHalberstadt!
[-]Champion: "Allow Obsolete attribute on getters and setters"[/-][+]Champion: "Allow Obsolete attribute on getters and setters" (16.3, Core 3)[/+]