Fork me on GitHub
TypeName RedundantFieldAssignmentAnalyzer
Check Id CC0034
Category Usage
Severity Info

Cause

It’s recommend not to assign the default value to a field as a performance optimization.

Example

class SampleClass
{
    private int number = 0;
    // ...
}

Code fix

A code fix will be presented to you that will transform the code, it will remove the initialization with the default value.

class SampleClass
{
    private int number;
    // ...
}

Code fix

Related rules

TBD

See also

TBD