ReSharper 2026.1 Help

Code inspection: Replace with primary constructor parameter

This inspection reports a private field in a type with a primary constructor when that field only stores a primary-constructor parameter and all its usages can refer to the parameter directly. In that case, the extra field does not add useful behavior and only duplicates state.

Example

public class User(string name) { private readonly string _name = name; public string DisplayName => _name; }
public class User(string name) { public string DisplayName => name; }

Quick-fix

Removing the field makes it clear that the value comes directly from the primary constructor and avoids maintaining two names for the same data.

30 March 2026