[Solved] remove null items from a multidimensional array in C#


Finally I solved my problem with multidimensional arrays by using a method as below:

public object[,] clear_array_nulls(object[,] input)
    {
        int m = input.GetUpperBound(0);
        int n = input.GetUpperBound(1) + 1;
        object[] temp = new object[input.GetUpperBound(0)];
        for (int x = 0; x < m; x++)
            temp[x] = input[x, 0];
        temp = temp.Where(s => !object.Equals(s, null)).ToArray();
        object[,] output = new object[temp.Length, n];
        Array.Copy(input, output, temp.Length * n);
        return output;
    }

solved remove null items from a multidimensional array in C#