No - at least not now, with standard building tools. It is possible that when the compiler as a service project is submitted, this may reveal this functionality. But the C # compiler does change its behavior to a few well-known attributes.
Two options you can consider:
- Postprocessing with something like PostSharp
- Unit test to find all attributes and test them in this way
Personally, I will probably go with the latter ... although there really is no obvious benefit - if you remember to declaratively add the [Check] attribute, would you not want to add a public setter? Or, to put it another way: if you forgot to enable the public setter, can't you forget to enable this attribute?
source share