0

我像这样声明了我的多维数组:

Dim invoice_discountitems(100, 1) As String

我用这个填充我的数组:

'Fill Array with items discounts
                        For i As Int16 = 0 To data_set.Tables("discount_items").Rows.Count - 1
                            invoice_discountitems(i, 0) = data_set.Tables("discount_items").Rows(i).Item("item_code")
                            invoice_discountitems(i, 1) = data_set.Tables("discount_items").Rows(i).Item("discountitem_average")
                        Next

现在我怎样才能删除这个数组的填充项?提前致谢

4

1 回答 1

2

因为数组是静态大小的,所以空数组与新初始化的数组相同。所以,如果你想清除整个事情:

invoice_discountitems = New String(100, 1)

或者,如果您想清除特定元素,请使用 Array.Clear()

Array.Clear(invoice_discountitems, 1, 10)
于 2012-04-26T17:38:27.913 回答