ReSharper 2026.1 Help

Code inspection: Replace with 'field' keyword

This inspection reports a private backing field that is only used to implement a property and can be replaced with the contextual field keyword inside that property. This removes the separate field declaration while keeping the property's custom accessor logic.

Example

private string _name = ""; public string Name { get => _name; set => _name = value ?? throw new ArgumentNullException(nameof(value)); }
public string Name { get; set => field = value ?? throw new ArgumentNullException(nameof(value)); } = "";

Quick-fix

The property keeps its behavior, but the code becomes smaller because the dedicated backing field is no longer needed.

30 March 2026