coderushforroslyn-400842-static-code-analysis-analyzers-library-crr0043-unused-type.md
This analyzer detects types (for example, classes, records, and record structs) that are not referenced in code. Specify accessibility levels for these types in the CodeRush options dialog:
The following example demonstrates how the analyzer detects an unused internal class:
Tip
Use the Highlight unused code in editor check box in the Editor | C# (Visual Basic) | Code Analysis | General option page to enable or disable the highlighting of unused types in the code editor.
To fix this issue, perform one of the following actions in the code:
Remove the unused internal class:
Call the Remove Unused Type refactoring.
Use the Remove unused types rule to remove unused internal types in different places at once:
Specify options as shown in the screenshot below. This allows CodeRush to apply this cleanup rule when you save a document and when you run code cleanup.
Run Code Cleanup.
You can use the Remove unused private types rule to remove unused private types.
See Also