deepsourcestatus / test-repository

Consider simplifying LINQ query by dropping explicit .Where() call CS-R1046
Anti-pattern
Major
8 months ago8 months old
Consider rewriting .Where(predicate).Count() as .Count(predicate)
 45
 46        // CS-R1046: Rewrite `arr.Where(x => x % 3 == 0).Count()` as `arr.Count(x => x % 3 == 0)`.
 47        // https://deepsource.io/directory/analyzers/csharp/issues/CS-R1046
 48        var threeMultiples = arr.Where(x => x % 3 == 0).Count(); 49
 50        // CS-R1047: Use `T?` instead of `Nullable<T>`.
 51        // https://deepsource.io/directory/analyzers/csharp/issues/CS-R1047