Code Inspection: Use method Any()
In a code snippet like this:
if (myEnumerable.Count() > 0)
ReSharper suggests replacing the
Count() > 0
part with the
extension method for two reasons. First,
without parameters is quicker than
as it does not iterate through the whole collection.
improves the readability of your code, indicating that the developer just wants to check if there
are any items in the collection and isn't concerned with the exact number of items.