Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 677 Bytes

File metadata and controls

38 lines (25 loc) · 677 Bytes
layout page
title CC0005
tagline EmptyObjectInitializerAnalyzer

|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

{% highlight csharp %} var a = new A() { }; {% endhighlight %}

Code fix

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

{% highlight csharp %} var a = new A(); {% endhighlight %}

![Code fix]({{ BASE_PATH }}/assets/images/CC0005/codefix0.png)

Related rules

None

See also

TBD