I found myself often using the quite uncomfortable
Searching for something unrelated, I found in an old thread this magic:
Which turns out to be a fantastic alternative without so much boilerplate, and also the recommended way to override
fieldnames functionality for those situations in which you want to keep attributes private, etc. The thing is, this is poorly documented.
A quick search in the docs shows that
- is referenced more times across the docs (8 times)
- is referenced within “more important sources”, i.e., Essentials and Types pages
- is referenced twice within devdocs, Reflection and ASTs
- is less referenced (only 4 times)
- only shows up in one “important” page, Essentials, which is the least self-explanatory source of information, because it is just a collection of Base
However, there is a more important point to make here, further than achieving more coverage for
propertynames (quote for emphasis):
Properly documenting the distinction between properties and fields.
Several programming patterns depend upon exposing some fields of an struct and hiding others, or discouraging direct access to struct fields and rather use “getters”/“setters” (or any ad hoc method). This is the nature of the difference between fields and properties, and should be explained somewhere.
Can I propose a PR? Will it be welcome? Is this just me?