Summarize properties with same accessors #2811
Replies: 17 comments
-
How would xml comments on those properties work? |
Beta Was this translation helpful? Give feedback.
-
I can't agree with this. I understand the appeal, but I recently had to refactor a bunch of code that a VB6 guy wrote almost 20 years ago which declared variables like |
Beta Was this translation helpful? Give feedback.
-
@Pretasoc, ha. I don't like this idea, but seriously, anyone putting XML comments on auto-properties ought to be hung, drawn and quartered (strictly figuratively) for cluttering code with pointless noise. 😆 |
Beta Was this translation helpful? Give feedback.
-
@DavidArno can you explain why would auto-properties deserve any less documentation than fully implemented properties? You even get compiler warnings for not documenting public members. |
Beta Was this translation helpful? Give feedback.
-
Because I can tell what the following does in one line:
And the additional information content of adding an XML comment, taking up four lines is precisely zero:
The information content is still the same, but there's now three lines of non-information (ie noise) to wade through, which makes the file harder to read. It offers nothing useful intellisense-wise either. Even worse, did you notice the error in the comment? It says "Gets". Yet the property supports |
Beta Was this translation helpful? Give feedback.
-
I don't want to derail this issue, but I think a lot of people would rather have too much documentation than too little, especially for public libraries. The number of nuget packages I've used which had a completely insufficient level of documentation on depresses me. If I'm using a library and some property has noddy documentation on it, that at least tells me that there's no hidden complexity there. If a property is undocumented, I simply don't know whether that's because it was too simple to document, or whether it's actually got some weird side-effects or gotchas which the author just didn't bother to document. Your circumstances and the users of your code will all affect your attitude to documentation, but let's not dismiss people who like seeing documentation. |
Beta Was this translation helpful? Give feedback.
-
I think records may help provide an easy way to reduce clutter in data classes. |
Beta Was this translation helpful? Give feedback.
-
This has been proposed before: #818. |
Beta Was this translation helpful? Give feedback.
-
I am sorry @DavidArno, but I cannot support your argument.
I randomly browsed Roslyn repository and found e.g. this property: |
Beta Was this translation helpful? Give feedback.
-
My first reaction on reading this is that you're declaring two public fields ( |
Beta Was this translation helpful? Give feedback.
-
@DavidArno, I agree with you that this kind of documentation comment is worse than useless
But I differ in the solution - I'd want the comment expanded to tell me more. Assume we're talking about a |
Beta Was this translation helpful? Give feedback.
-
Agreed. There are very simple settable boolean properties that may have deep implications for my type/system. Doc comments are vital here. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Since the topic of docs has come up, I've been wondering, is XML commenting considered part of the C# language, or is it some corefx thing or even Rosyln? Where would a proposal go? 99% of the code I see only uses It would even cross-over into VS tooling, I guess, because I'd also like an editor option to control the default when I type |
Beta Was this translation helpful? Give feedback.
-
Something like https://gist.github.com/sharwell/ab7a6ccab745c7e0a5b8662104e79735? |
Beta Was this translation helpful? Give feedback.
-
I think that's proposed here: #2549 |
Beta Was this translation helpful? Give feedback.
-
@HaloFour Thanks ... er, I even thumbed-up that one at some point in the past! 😀 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is:
Want:
Beta Was this translation helpful? Give feedback.
All reactions