JetBrains Rider 2026.1 Help

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

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

Example

int count = items.Where(x => x.IsActive).Count();
int count = items.Count(x => x.IsActive);

Quick-fix

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

29 March 2026