How to merge two IQueryable lists

You’re not using the return value – just like all other LINQ operators, the method doesn’t change the existing sequence – it returns a new sequence. So try this:

var list3 = list1.Concat(list2);

or

var list4 = list1.Union(list2);

Union is a set operation – it returns distinct values.

Concat simply returns the items from the first sequence followed by the items from the second sequence; the resulting sequence can include duplicate items.

You can think of Union as Concat followed by Distinct.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)