The requested page is not available for the requested platform. You are viewing the content for Default platform.

The params parameter must be a single dimensional array

CodeRush Classic shows the The params parameter must be a single dimensional array code issue if a params parameter is a multidimensional array or a non-array parameter.

Fix

Remove the params parameter modifier.

Purpose

Highlights the array parameter declarations, which would cause the The parameter array must be a single dimensional array compilation error.

Example

public static int[,] MultiplyMatrix(int multiplyer, params int[,] matrix)
{
    for (int i = 0; i < matrix.GetLength(0); i++)
    {
        for (int j = 0; j < matrix.GetLength(1); j++)
        {
            matrix[i,j] = matrix[i,j] * multiplyer;
        }
    }
    return matrix;
}

Fix:

public static int[,] MultiplyMatrix(int multiplyer, int[,] matrix)
{
    for (int i = 0; i < matrix.GetLength(0); i++)
    {
        for (int j = 0; j < matrix.GetLength(1); j++)
        {
            matrix[i,j] = matrix[i,j] * multiplyer;
        }
    }
    return matrix;
}