Fork me on GitHub
TypeName EmptyObjectInitializerAnalyzer
Check Id CC0005
Category Style
Severity Warning

Cause

An empty object initializer doesn’t add any information and only clutter the code. If there is no member to initialize, prefer using the standard constructor syntax.

Example

var a = new A() { };

Code fix

A code fix will be presented to you that will transform the code:

var a = new A();

Code fix

Related rules

None

See also

TBD