Skip to main content

Unused Code Analysis

Unused Type, Unused Member, Unused Parameter, and Empty Event Handler diagnostics can detect unused code in types, members, and method parameters based on the specified member/type accessibility level.

  1. Open the Editor | C# (Visual Basic) | Code Analysis | Unused Code Analysis options page.
  2. Specify accessibility levels (private, protected, private protected, protected internal, internal or public) for types, members, and methods that contain parameters you want to analyze.

For example, set the public option and uncheck other options in members accessibility to allow CodeRush to detect unused public members only.

RemoveQualifier

The following example demonstrates how the Unused Member analyzer detects an unused public member:

RemoveQualifier