Code inspection: Remove ToList()
Creating a temporary list is unnecessary when LINQ can count matching items directly on the original sequence.
Example
var count = source.ToList().Count(x => x.IsActive);
var count = source.Count(x => x.IsActive);
Quick-fix
Remove the unnecessary ToList() call.
29 March 2026