Problem sovled. Created a new list from my array, and deleted the element in the list, and set my intial array to my list.ToArray.
Asked
Active
Viewed 220 times
-3
-
3since I can't use Remove with T[] Arrays. Why? – Nikhil Agrawal Mar 24 '13 at 17:21
-
An array has a fixed length, and you can't actually remove from it. One thing you can do is overwrite the existing element with "nothing". But that will leave a "hole" in the array. Like this: `tab[find] = default(T);` Depending on what `T` is you can also use `null` or `new T()`. – Jeppe Stig Nielsen Mar 24 '13 at 17:48
1 Answers
4
Yes, you cannot remove element out of tab because tab is declared as array [] which does not support Remove method, if possible, declare tab as List<T>, so you are able to call Remove from List<T>
cuongle
- 71,850
- 28
- 140
- 203