0
我有一個動態的陣列,其中該陣列的尺寸的變化,根據在數據庫中的節數的行 碼是這樣的:任何快捷方法重新初始化陣列在vb.net
Dim pgm_act_arr(0) As Double
Dim pgm_act_count As Integer = no.of rows retuned from database
ReDim pgm_act_arr(pgm_act_count)
for each rows in database1
'i want to reinitialize the array here
'now am using for loop to reinitialize array to zero
For i As double to pgm_act_arr.Length
pgm_act_arr(i) = 0.0
Next
for each rows in database2
pgm_act_arr(index)+=somevalue 'inserting values to array elements
next
next
是否有任何單行代碼或任何短手操作來重新初始化數組
僅僅是明確@codebits你是不是每次redimension數組,但只需要設定其所有元素爲0? – OSKM
是的,我想重置數組元素爲'0'\零 – Codebits
在這種情況下,您的方法是我所知道的最好的。 – OSKM