public static double[][] ConvertToDouble(int[,] arr , int r , int c)
    {
        double[][] matrix = new double[r][c];
        for(int i=0;i<r;i++)
        {
            for(int j=0;j<c;j++)
            {
                matrix[i][j] = Convert.ToDouble(arr[i,j]);  //the error comes in this line
            }
        }
        return matrix;
    }
iam here trying to create a function that converts int[,] to double[][] and i got a System.NullReferenceException
 
     
    