Skip to main content

Lambda parameter has redundant type specification

In This Article

CodeRush Classic shows the Lambda parameter has redundant type specification code issue if lambda expression parameters have type specifiers.

#Fix

Remove the redundant type specifiers.

#Purpose

Highlights the type specifiers for lambda expression parameters, which can be removed to improve your code readability.

#Example

Func<string, string, int> GetLength = (string str1, string str2) =>
{
    return str1.Length + str2.Length;
};

Fix:

Func<string, string, int> GetLength = (str1, str2) =>
{
    return str1.Length + str2.Length;
};