TypeName | ObjectInitializerAnalyzer |
Check Id | CC0008 |
Category | Style |
Severity | Warning |
When possible an object initializer should be used to initialize the properties of an object instead of multiple assignments.
var p = new Person();
p.Name = "Mahmoud";
p.Age = 25;
A code fix will be presented to you that will transform the code:
var p = new Person()
{
Name = "Mahmoud",
Age = 25
};
TBD