Reputation: 11
I have a dataset with 2 tables, so I declared 2 ArrayList
and fetching that table values from DataSet
into two ArrayList
s.
One ArrayList
has the count of 66, another of 37.
Now, how do I combine these ArrayList
s into one ArrayList
so that I get values of both ArrayList
into an single ArrayList
?
Upvotes: 1
Views: 614
Reputation: 393134
Linq style:
IList<int> both = arrlist1.Cast<int>().Concat(arrlist2.Cast<int>()).ToList();
Upvotes: 0
Reputation: 545618
You can use the AddRange
method. But you shouldn’t use ArrayList
s, they are deprecated. Use the generic List
class instead.
Furthermore, are you sure you need the separate values at all? Aren’t the data sets enough?
Upvotes: 2