Remove element of a regular array

前端 未结 15 2241
野性不改
野性不改 2020-11-22 10:06

I have an array of Foo objects. How do I remove the second element of the array?

I need something similar to RemoveAt() but for a regular array.

15条回答
  •  渐次进展
    2020-11-22 10:29

    Try below code:

    myArray = myArray.Where(s => (myArray.IndexOf(s) != indexValue)).ToArray();
    

    or

    myArray = myArray.Where(s => (s != "not_this")).ToArray();
    

提交回复
热议问题