In .NET (VB), how can I take all of the items in one collection, and add them to a second collection (without losing pre-existing items in the second collection)? I’m looking for something a little more efficient than this:
For Each item As Host In hostCollection1 hostCollection2.Add(item) Next
My collections are generic collections, inherited from the base class — Collection(Of )
You can use AddRange:
hostCollection2.AddRange(hostCollection1).