Add all properties to initializer
Property | Value |
---|---|
Id | RR0216 |
Applicable Syntax | object/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