Operator cannot have 'params' parameter

CodeRush Classic shows the Operator cannot have 'params' parameter code issue if an operator includes a params parameter.

Fix

Remove the params keyword from the operator parameter.

Purpose

Highlights the operator declarations, which would cause the params is not valid in this context compilation error.

Example

public class MyData
{
    public MyData(string name, List<string> data)
    {
        Name = name;
        Data = data;
    }
    public string Name { get; set; }
    public List<string> Data { get; set; }
    public static MyData operator +(MyData d1, params MyData[] dd)
    {
        string newName = d1.Name;
        List<string> newData = d1.Data;
        foreach (MyData dat in dd)
        {
            newName += "&" + dat.Name;
            newData.AddRange(dat.Data);
        }
        return new MyData(newName, newData);
    }
}

Fix:

public class MyData
{
    public MyData(string name, List<string> data)
    {
        Name = name;
        Data = data;
    }
    public string Name { get; set; }
    public List<string> Data { get; set; }
    public static MyData operator +(MyData d1, MyData[] dd)
    {
        string newName = d1.Name;
        List<string> newData = d1.Data;
        foreach (MyData dat in dd)
        {
            newName += "&" + dat.Name;
            newData.AddRange(dat.Data);
        }
        return new MyData(newName, newData);
    }
}