The params parameter must be the last parameter in a formal parameter list
CodeRush Classic shows the The params parameter must be the last parameter in a formal parameter list code issue if a params parameter is not the last parameter in the formal parameter list.
#Fix
Place the parameter with the params modifier at the last position.
#Purpose
Highlights the array parameter declarations, which would cause the A parameter array must be the last parameter in a formal parameter list compilation error.
#Example
public List<string> AddStrings(params string[] │strings, List<string> list)
{
if (list == null)
list = new List<string>();
foreach (string str in strings)
if (str.Length > 0)
list.Add(str);
return list;
}
Fix:
public List<string>; AddStrings(List<string> list, params string[] strings)
{
if (list == null)
list = new List<string>;();
foreach (string str in strings)
if (str.Length >; 0)
list.Add(str);
return list;
}