Partager via


CA1823: Avoid unused private fields

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Item Value
TypeName AvoidUnusedPrivateFields
CheckId CA1823
Category Microsoft.Performance
Breaking Change Non-breaking

Cause

This rule is reported when a private field in your code exists but is not used by any code path.

Rule Description

Private fields were detected that do not appear to be accessed in the assembly.

How to Fix Violations

To fix a violation of this rule, remove the field or add code that uses it.

When to Suppress Warnings

It is safe to suppress a warning from this rule.

CA1812: Avoid uninstantiated internal classes

CA1801: Review unused parameters

CA1804: Remove unused locals

CA1811: Avoid uncalled private code