Code inspection: Replace with single call to Last(..)
This inspection reports a LINQ query that filters with Where(...) and then immediately calls Last(). The same query is shorter and clearer as a single Last(...) call.
Example
var item = items.Where(x => x.IsActive).Last();
var item = items.Last(x => x.IsActive);
Quick-fix
Replace the Where(...).Last() chain with Last(...).
29 March 2026