I have a jagged array with a multidimensional array and want to remove an array inside the multidimensional array. My code is:
int[][,] arr = new int[4][,];
arr[0] = new int[,] {
{ 1, 2, 3 }, // <- I want to remove this row
{ 4, 5, 6 },
{ 5, 6, 7 },
{ 8, 9, 10 } };
arr[1] = new int[,] {
{ 1, 2, 3, 4 },
{ 5, 6, 7, 8 },
{ 9, 10, 11, 12 },
{ 13, 14, 15, 16 } };
arr[2] = new int[,] {
{ 1, 2, 3, 4, 5 },
{ 5, 6, 7, 8, 9 },
{ 10, 11, 12, 13, 14 },
{ 15, 16, 17, 18, 19 } };
arr[3] = new int[,] {
{ 1, 2, 3, 4, 5, 6},
{ 5, 6, 7, 8, 9, 10},
{ 11, 12, 13, 14, 15, 16 },
{ 17, 18, 19, 20, 21, 22 } };
int[,] removeArray = { { 1, 2, 3 } };
I tried to remove {1, 2, 3} from arr[0] by using Linq:
arr = arr
.Where((val, i) => i != 0)
.ToArray();
but this removes the whole arr[0] row. Does anyone know how I can get to remove {1,2,3} using Linq?