If it is an IList or some other object that has Count as a property, don't use the Linq extension method.
So this:
var count = myList.Count();
Becomes:
var count = myList.Count;
Important:
Count and Count() have to return the same type.
Count() has to be an extension method.
Diagnostic id: CC0098
Severity: Warning
Category: Performance
If it is an
IListor some other object that hasCountas a property, don't use the Linq extension method.So this:
Becomes:
Important:
CountandCount()have to return the same type.Count()has to be an extension method.Diagnostic id:
CC0098Severity: Warning
Category: Performance