Reset an Array to Default in Visual Basic 2010

微笑、不失礼 提交于 2019-12-25 06:25:42

问题


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


回答1:


you can try Array.Clear method :

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

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).

Another option is to use Erase

Erase myArray

that will turn myArray variable to Nothing.




回答2:


You can use Erase.

Erase YourArray



回答3:


System.Array.Clear(Array, 0, Array.length)

You can switch 0 to Nothing it depends on the variable in your array



来源:https://stackoverflow.com/questions/21643228/reset-an-array-to-default-in-visual-basic-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!