Mega Code Archive

 
Categories / VB.Net Tutorial / Collections
 

Copy array elements from one array to another

Module Tester     Sub Main()         Dim Values() As Integer = {100, 200, 300, 400, 500}         Dim MyValues(5) As Integer         Dim Prices() As Double = {25.5, 4.95, 33.4}         Dim I As Integer         For I = 0 To 4             Console.Write(Values(I) & " ")         Next         Console.WriteLine()         ' Copy one array to another         Values.CopyTo(MyValues, 0)         For I = 0 To 4             Console.Write(MyValues(I) & " ")         Next     End Sub End Module 100 200 300 400 500 100 200 300 400 500