ReSharper 2026.1 Help

Code inspection: Unassigned readonly field

This inspection reports readonly fields that are never assigned. A readonly field must be initialized either where it is declared or in a constructor. If it is left unassigned, it will keep its default value, which is often not what the code intends.

Example

class C { private readonly int value; }
class C { private readonly int value; public C(int value) { this.value = value; } }

Quick-fix

Initialize the readonly field in the constructor or at the declaration site.

01 April 2026