Imports System
Imports System.Collections
Public Class MainClass
Shared Sub Main(ByVal args As String())
Dim start_time As DateTime
Dim stop_time As DateTime
Dim elapsed_time As TimeSpan
' Get the number of items.
Dim num_items As Integer = 1000000
' One-dimensional Array.
Dim array3 As Array = _
Array.CreateInstance(GetType(Integer), num_items)
start_time = Now
For i As Integer = 0 To num_items - 1
array3.SetValue(i, i)
Next i
stop_time = Now
elapsed_time = stop_time.Subtract(start_time)
Console.WriteLine( elapsed_time.TotalSeconds().ToString )
End Sub
End Class
|