What's the simplest way to join one or more arrays (or ArrayLists) in Visual Basic?
I'm using .NET 3.5, if that matters much.
This is in C#, but surely you can figure it out...
int[] a = new int[] { 1, 2, 3, 4, 5 };
int[] b = new int[] { 6, 7, 8, 9, 10 };
int[] c = a.Union(b).ToArray();
It will be more efficient if instead of calling "ToArray" after the union, if you use the IEnumerable given instead.
int[] a = new int[] { 1, 2, 3, 4, 5 };
int[] b = new int[] { 6, 7, 8, 9, 10 };
IEnumerable<int> c = a.Union(b);
You can take a look at this thread that's titled Merging two arrays in .NET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With