Currently, SA1516 triggers a violation when a multiline property setter immediately follows a multiline getter without an empty line. While accessors are distinct elements, they are logically part of a single unit. In many professional codebases, including high-profile projects like Newtonsoft.Json, these accessors are kept together without separation to maintain visual cohesion. In fact, I have never seen a codebase where an empty line between a get and set is considered common practice.
public string Description
{
get
{
return _description;
}
set // SA1516 triggered here
{
_description = value;
}
}
Proposed change: modify SA1516 to allow (or provide a configuration to allow) omitting blank lines between:
get and set accessors
add and remove event accessors
Exception: when there is a comment line before the setter/remove.
Currently, SA1516 triggers a violation when a multiline property setter immediately follows a multiline getter without an empty line. While accessors are distinct elements, they are logically part of a single unit. In many professional codebases, including high-profile projects like Newtonsoft.Json, these accessors are kept together without separation to maintain visual cohesion. In fact, I have never seen a codebase where an empty line between a get and set is considered common practice.
Proposed change: modify SA1516 to allow (or provide a configuration to allow) omitting blank lines between:
getandsetaccessorsaddandremoveevent accessorsException: when there is a comment line before the setter/remove.