Code Inspection: Redundant lambda parameter explicit type specification
When you instantiate a delegate by using a lambda expression, and pass input parameters to the lambda expression, it might be unnecessary to specify types of those parameters because the compiler can infer them in most cases. For example, if the types accepted by the method were already specified in the delegate declaration, you can omit the types when you specify the method's input parameters.
In the example below, the declared delegate
sum is compatible with methods that return an integer value and accept two parameters of the integer type. Therefore, it is safe to remove type specifiers for the parameters
y, and JetBrains Rider suggests that you do so:
|Suboptimal code||After the quick-fix|
| || |