从二维数组中删除元素 [英] Delete element from a 2-D array
问题描述
有没有简单的方法从2D数组中删除元素?
感谢您的提示。
Hugh
Hi,
Is there easy way to delete elements from a 2D array?
Thanks for your tip.
Hugh
推荐答案
*" Hugh" <一个******* @ discussions.microsoft.com> scripsit:
* "Hugh" <an*******@discussions.microsoft.com> scripsit:
是否有简单的方法从2D数组中删除元素?
Is there easy way to delete elements from a 2D array?
将其设置为特定值。 删除是什么意思?请
提供您想要做的简单样本。
-
Herfried K. Wagner [MVP]
< http://www.mvps.org/dotnet>
Set it to a specific value. What do you mean with "delete"? Please
provide a simple sample of what you want to do.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
" Hugh" <一个******* @ discussions.microsoft.com> schrieb
"Hugh" <an*******@discussions.microsoft.com> schrieb
有没有简单的方法从2D数组中删除元素?
Is there easy way to delete elements from a 2D array?
这是不可能的,因为长度(=数组的大小是固定的。你要
必须将数组复制到一个新数组而不删除项目。或者,
使用arraylist或任何其他类型的集合。更多信息:
http://msdn.microsoft.com/library/en...ollections.asp
另一个选择是将数组中的项目复制到新位置
(覆盖要删除的项目),然后使用Redim Preserve更改
大小。 Redim Preserve还会创建一个新数组,但它可能是最简单的
解决方案。尽管如此,Redim Preserve只能改变
最高等级的大小。
-
Armin
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/ news / learn2quote.html
This is not possible because the length (= size) of an array is fixed. You''d
have to copy the array to a new array without the item to be removed. Or,
use an arraylist or any other sort of collection. More info:
http://msdn.microsoft.com/library/en...ollections.asp
Another option is to copy the items within the array to the new position
(overwriting the item to be removed), then use Redim Preserve to change the
size. Redim Preserve also creates a new array, but it might be the simplest
solution. Nevertheless, Redim Preserve can only change the size of the
highest rank.
--
Armin
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
嗨休,
如果2d数组是数据表或者是一个arraylist,而不是很容易的
使用remove,removeat with arraylist(或Ilist的其他实现
数组)
>
使用delete,deleteat,remove,removeat with the datatable
我希望这有帮助吗?
Cor
Hi Hugh,
If the 2d array is a datatable or an arraylist, than it is easy possible
using remove, removeat with arraylist (or other implementations of Ilist
arrays)
using delete,deleteat,remove, removeat with the datatable
I hope this helps?
Cor
有没有简单的方法从2D数组中删除元素?
感谢您的提示。
休
Is there easy way to delete elements from a 2D array?
Thanks for your tip.
Hugh
这篇关于从二维数组中删除元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!