The Union method excludes the duplicates as given here
http://msdn.microsoft.com/en-us/library/bb341731.aspx#Y100[
^]
So, if there is a statement say
"35+10-3"
which gives the result
"42"
, then this will not be included in the union of statements and results.
Concat
method can be used. If it is used all the elements from first array are listed first and then the elements of the second array are listed. But as given in the question,
result, statement
order is required. In which case I think the following code can be used for better control on the order of the elements
Dim statements As String() = {"40+5-3", "5+10-2", "35+10-3"}
Dim results As String() = {"42", "13", "42"}
If statements.Length <> results.Length Then
Console.WriteLine("The number of Statements and number of Results should be equal")
Return
End if
Dim resultsStatements As String() = New String(statements.Length * 2 - 1) {}
Dim i As Integer = 0
While i < statements.Length
resultsStatements(i * 2) = results(i)
resultsStatements(i * 2 + 1) = statements(i)
i += 1
End While
For Each element As String In resultsStatements
Console.WriteLine(element)
Next