Hi for scool projet i create tetris game in c# i want to create saveGame Feature but i can't convert int[,] to int[][]
private int[,] grid { get; }
public int this[int r, int c]
        {
            get => grid[r, c];
            set => grid[r, c] = value;
        }
public int[][] LoadGird()
        {
            int[][] gridValue = null!;
            List<int> gridRows;
            for ( int r = 0; r < rows; r++)
            {
                gridRows = null!;
                for(int c = 0; c < colums; c++)
                {
                    if (this[r,c] != null) gridRows.Add(this[r,c]);
                }
                    gridValue.Append(gridRows.ToArray());
            }
            return gridValue;
        }
When i want add this[r,c] at my int[] gridRows i have this error
System.NullReferenceException: 'Object reference not set to an instance of an object.
Does anyone have a solution?
I edit my LoadGrid Func to This
public int[][] LoadGird()
        {
            int[][] gridValue = new int[22][];
            List<int> gridRows;
            for ( int r = 0; r < rows; r++)
            {
                gridRows = new List<int>();
                for(int c = 0; c < colums; c++)
                {
                    int value = this[r, c];
                    if (this[r,c] != null) gridRows.Add(value);
                }
                gridValue[r] = gridRows.ToArray();
            }
            return gridValue;
        }
And my code work thanks
 
    