问题
If my array is A(i,j) can I use Array.Clear to zero all of the elements for i=2, for example. It does not work as I expected.
回答1:
Take a look at this example. If I want to initialize all the elements for the second row (index = 1) I specify the starting position in the array ordered by row ascending, column ascending and the number of records to clear as the number of columns in your array.
Dim arr(,) As Integer = {{1, 2, 3}, {4, 5, 6}}
Array.Clear(arr, 1 * 3, 3)
Clearing the entire array would be
Array.Clear(arr,0,6)
来源:https://stackoverflow.com/questions/4888312/clear-part-of-the-data-from-a-two-dimension-integer-array