If you find a call to Count() > 0 and the object supports Any(), change it Any().
If you find a call to Count(predicate) > 0 and the object supports Any(<predicate type>), change it Any(predicate).
So this:
var any = myEnumerable.Count() > 0;
Becomes:
var any = myEnumerable.Any();
And:
var any = myEnumerable.Count(i => i > 3) > 0;
Becomes:
var any = myEnumerable.Any(i => i > 3);
Diagnostic id: CC0099
Severity: Information
Category: Style
If you find a call to
Count() > 0and the object supportsAny(), change itAny().If you find a call to
Count(predicate) > 0and the object supportsAny(<predicate type>), change itAny(predicate).So this:
Becomes:
And:
Becomes:
Diagnostic id:
CC0099Severity: Information
Category: Style