Lambda expression cannot have 'params' parameter

CodeRush shows the Lambda expression cannot have 'params' parameter code issue if a lambda expression has a params parameter.

Fix

Remove the params keyword from the lambda expression.

Purpose

Highlights the lambda expressions, which would cause compilation errors due to the use of the params keyword.

Example

Func<string[], string> GetLongestItem = (params string[] strings) =>
{
    string result = string.Empty;
    foreach (string str in strings)
        if (str.Length > result.Length)
            result = str;
    return result;
};

Fix:

Func<string[], string> GetLongestItem = strings =>;
{
    string result = string.Empty;
    foreach (string str in strings)
        if (str.Length > result.Length)
            result = str;
    return result;
};