JaredPar's answer will give you an object that will enumerate over both lists. If you actually want a List(Of String)
object containing these values, it's as simple as:
Dim combined As New List(Of String)(los1.Concat(los2));
EDIT: You know, just because you're using .NET 2.0 doesn't mean you can't roll your own versions of some of the LINQ extension methods you personally find useful. The Concat
method in particular would be quite trivial to implement in C#*:
public static class EnumerableUtils {
public static IEnumerable<T> Concat<T>(IEnumerable<T> first, IEnumerable<T> second) {
foreach (T item in first)
yield return item;
foreach (T item in second)
yield return item;
}
}
Then, see here:
Dim los1 as New List(Of String)
los1.Add("Some value")
Dim los2 as New List(Of String)
los2.Add("More values")
Dim combined As New List(Of String)(EnumerableUtils.Concat(los2, los2))
* To be fair, this is a lot more straightforward in C# thanks to the yield
keyword. It could be done in VB.NET, but it'd be trickier to provide deferred execution in the same manner that the LINQ extensions do.