Back to Devexpress

CRR0046 - Redundant field initialization

coderushforroslyn-401171-static-code-analysis-analyzers-library-crr0046-redundant-field-initialization.md

latest825 B
Original Source

CRR0046 - Redundant field initialization

  • Feb 28, 2025

This analyzer identifies redundant field initialization values, which can be removed to improve code readability.

csharp
public int sum = 0;
vb
Public sum As Integer = 0

To fix the issue, remove the field’s redundant default value:

csharp
public int sum;
vb
Public sum As Integer

Call the Remove Redundant Assignment refactoring to remove the redundant field initialization.

See Also

Suppress Analyzers