Unnecessary code rules

Unnecessary code rules identify different parts of the code base that are unnecessary and can be refactored or removed. The presence of unnecessary code indicates one of more of the following problems:

  • Readability: Code that is unnecessarily degrading readability. For example, IDE0001 flags unnecessary type-name qualifications.
  • Maintainability: Code that is no longer used after refactoring and is unnecessarily being maintained. For example, IDE0051 flags unused private fields, properties, events, and methods.
  • Performance: Unnecessary computation that has no side effects and leads to unnecessary performance overhead. For example, IDE0059 flags unused value assignments where the expression to compute a value has no side effects.
  • Functionality: Functional issue in code leading to required code being rendered redundant. For example, IDE0060 flags unused parameters where the method accidentally ignores an input parameter.

The rules in this section concern the following unnecessary code rules:

Some of these rules have options to configure the rule behavior:

See also