Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 642 Bytes

File metadata and controls

38 lines (25 loc) · 642 Bytes
layout page
title CC0015
tagline UnnecessaryParenthesisAnalyzer

|TypeName|UnnecessaryParenthesisAnalyzer | |Check Id | CC0015 | |Category | Style | |Severity | Warning |

Cause

There is no need to specify that the no-parameter constructor is used with an initializer as it is implicit

Example

{% highlight csharp %} var p = new Person() { X = 1 }; {% endhighlight %}

Code fix

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

{% highlight csharp %} var p = new Person { X = 1 }; {% endhighlight %}

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

Related rules

None

See also

TBD