Code inspection: Redundant accessor body
This inspection reports a property accessor body that is redundant and can be replaced with an auto-accessor. Tthis happens when the accessor just returns or assigns field without adding meaningful extra logic.
Example
public string Name
{
get => field;
set => field = value ?? throw new ArgumentNullException(nameof(value));
}
public string Name
{
get;
set => field = value ?? throw new ArgumentNullException(nameof(value));
}
Quick-fix
Replace the redundant accessor body with an auto-accessor.
30 March 2026