Reputation: 3
Hi can someone help me deleting array in multidimensional this code keeps on Array out of Bound
```
int[,] Arr = {
{ 10,20,30,40},
{ 10,20,30,40},
{ 10,20,30,40},
{ 10,20,30,40}
};
int index = 1;
for(int x = 0; x <= 3; x++) {
for (int i = index; i < Arr.Length - 1; i++)
{
Arr[i, x] = Arr[i + 1, x];
}
}
```
Upvotes: 0
Views: 143
Reputation: 890
The Length
property returns the length of the first dimension. When you want to access the other dimensions, you have to use the GetLength()
method. See this SO.
Upvotes: 2