JetBrains Rider 2026.1 Help

Code inspection: Replace with single call to SingleOrDefault(..)

This inspection reports a LINQ query that filters with Where(...) and then immediately calls SingleOrDefault(). The same query is shorter and clearer as a single SingleOrDefault(...) call.

Example

var item = items.Where(x => x.IsActive).SingleOrDefault();
var item = items.SingleOrDefault(x => x.IsActive);

Quick-fix

Replace the Where(...).SingleOrDefault() chain with SingleOrDefault(...).

29 March 2026