前端之家收集整理的这篇文章主要介绍了
[VB.NET]往数组尾部加一项的方法是什么方法?,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
往数组尾部加一项的
方法是什么
方法? VB.NET中,往数组尾部加一项的
方法是什么
方法? 找不到啊! __________________________________________________________________________ Preserve redim __________________________________________________________________________ 好像,array类里头没有这个
方法啊 __________________________________________________________________________ Public Class Form1 Private Sub Form1_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load Dim int(10) As Int32 For i As Int32 = 0 To int.GetUpperBound(0) int(i) = i Next Msg
Box(int(10)) ReDim Preserve int(11) int(11) = 11 Msg
Box(int(9) & " " & int(10) & " " & int(11)) End Sub End Class __________________________________________________________________________ redim重新定义数组的容量,
加上Preserve关键字使得这一过程中数组中原有数据不丢失。 __________________________________________________________________________ 谢谢magicbacon! 谢谢! __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263865.html