Copy arrays without looping

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to copy 1-D arrays to columns of a 2-D array. Is there a way of doing that without using a loop that will copy element by element?
 
Hi Amjad,

A sample I once made.

\\\
Option Strict On
Public Module Main
' Sample of an arraylist that itself contains 10 classic arrays.
Public Sub Main()
Dim a As New ArrayList
Dim B() As Integer = {1, 2, 3, 4}
For i As Integer = 0 To 9
a.Add(B)
Next
MessageBox.Show(DirectCast(a(9), IList)(2).ToString)
'With option strict off you do not
'have to use the directcast but and than it is
'MessageBox.Show(a(2)(2).ToString) 'but I would not do that
'I show this to make it more classic looking for you.
End Sub
End Module
///

I hope this helps a little bit?

Cor


"> I want to copy 1-D arrays to columns of a 2-D array. Is there a way of
doing that without using a loop that will copy element by element?
 
Array.Copy

Amjad said:
I want to copy 1-D arrays to columns of a 2-D array. Is there a way of
doing that without using a loop that will copy element by element?
 
Back
Top