Select()
is redundant CS-P1015The Select()
method from System.Linq
transforms an IEnumerable<T>
's elements based on the lambda specified. An identity function is a function that returns the same element unchanged that was passed as its argument. Since such a function does nothing useful, passing it to Select()
does not modify the elements and is just a redundant expression. It is recommended that you drop such redundant expressions.
var filtered = elements.Select(x => x).Where(x % 4 == 0);
var filtered = elements.Where(x % 4 == 0);