Skip to main content

Add all properties to initializer

PropertyValue
IdRR0216
Applicable Syntaxobject/record initializer
Enabled by Default✓

Usage​

Example #1​

before.cs
class C
{
public string P1 { get; set; }
public string P2 { get; set; }

void M()
{
var x = new C() { };
}
}
after.cs
class C
{
public string P1 { get; set; }
public string P2 { get; set; }

void M()
{
var x = new C() { P1 = , P2 = };
}
}

Configuration​

roslynator_refactoring.add_all_properties_to_initializer.enabled = true|false