重置数组在Visual Basic 2010为默认 [英] Reset an Array to Default in Visual Basic 2010

查看:118
本文介绍了重置数组在Visual Basic 2010为默认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是code重置数组为默认状态,使所有的元素都被删除?

What is the code to reset an array to its default state so that all the elements are erased?

推荐答案

您可以尝试的 Array.Clear 方式:

Array.Clear(myArray, 0, myArray.Length)

这将恢复每个数组元素的值设置为default( 0 没有根据上文中的链接描述的元素类型)。

that will revert value of each array element to default (0, false, or Nothing depending on the element type as described in the link above).

另一种选择是使用擦除

Erase myArray

这会变成 myArray的变量没有

这篇关于重置数组在Visual Basic 2010为默认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆