简体   繁体   中英

How do I delete items in a multidimensional array and will it change the array length?

Say I have a 3d array:

int[,,] arr = new int[3, 2, 3];

How can I delete all items under one of the first dimension? And if that can be done, will that move up all the values under it? Or will the deleted items just take null values and be counted in the arr.GetLength(0) method?

I've found a C# version of the Visual Basic's ReDim method. https://stackoverflow.com/a/327958/9076546 Note that dynamic array sizes aren't the best for performance. ReDim was a mistake in my honest opinion...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM