JetBrains Rider 2024.1 Help

Code Inspection: Non-accessed field (Private accessibility)

Category

Potential Code Quality Issues

ID

NotAccessedField.Local

EditorConfig

resharper_not_accessed_field_local_highlighting

Default severity

Warning

Language

C#, VB.NET, XAML

Requires SWA

No

C# compiler can issue a number of warnings regarding unused fields:

Although JetBrains Rider knows about all these warnings and provides design-time notifications for them, it goes one step further and detects unused fields not covered by compiler warnings. The example below shows that even if a field is assigned non-constant value and has no read usages, JetBrains Rider will help you detect the unused member.

class Foo { private int _a; // CS0414 private int _b; // No compiler warnings, but JetBrains Rider issues its own warning here public Foo(int value) { _a = 1; _b = value; } }
Last modified: 10 April 2024