M
M
Mr. Abdu Jan2014-09-23 12:17:49
Visual Basic
Mr. Abdu Jan, 2014-09-23 12:17:49

How to create an array from two arrays?

Hello,
I have two arrays of the same size.

Dim arr1() As String = {"Hello", "world", "I'm", "some", "text"}
Dim arr2() As String = {"Hello2", "world2", "I'm2", "some2", "text2"}

I need to create another array from these two arrays.
Like this:
Dim arr3(0) As String = {"Hello", "Hello2"}
Dim arr3(1) As String = {"world", "world2"}
Dim arr3(2) As String = {"I'm", "I'm2"}
Dim arr3(3) As String = {"some", "some2"}
Dim arr3(4) As String = {"text", "text2"}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mr. Abdu Jan, 2014-09-23
@Abdukhafiz

Dim arr1() As String = {"Hello", "world", "I'm", "some", "text"}
Dim arr2() As String = {"Hello2", "world2", "I'm2", "some2", "text2"}

Dim arr3 = arr1.Zip(arr2, Function(a, b) {a, b}).ToArray()

Link to source

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question