Written By:- Isha Malhotra
Concat method is used to concat two data sources. In my last article I used union method to concat two data sources.
Both methods are used to concat data but when we use concat method it will concat without removing redundancy but union method remove redundancy.
Note: - For union method check the article Set Operation in LINQ
//data source first
int[] ar1 = { 1, 2, 3, 4, 5 };
//data sourse second
int[] ar2 = { 4, 5, 6, 7, 8 };
//concat method implementation
IEnumerable<int> res = ar1.Concat(ar2);
foreach (int p in res)
{
Response.Write(p + "<br/>");
}
The output will be as follows:-
Figure 1
For any query you can send mail at info@techaltum.com
Thanks