ReSharper 2017.1 Help

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, the declared delegate sum is compatible with methods that return an integer value and accept two parameters of the integer type. ReSharper can remove type specifiers for parameters x and y:

Suboptimal codeAfter the quick-fix
Last modified: 12 October 2017

See Also