C#

C#

Made by DeepSource

Consider dropping the parameter's name if it is same as the value when instantiating an anonymous object CS-R1127

Anti-pattern
Major
Autofix

Initializers let you specify the parameter name explicitly when instantiating an object (both named and anonymous objects). However, if you're instantiating an anonymous object and the parameter's name is same as the value, consider dropping the name altogether as it is redundant.

Bad Practice

new Person
{
    name = name,
    age = 25,
}

Recommended

new Person
{
    name,
    age = 25,
}