Skip to content
Yasser Moradi edited this page Aug 26, 2015 · 2 revisions

Description:

The Union operator allows the items of two collections to be combined into a single resultant list. If any duplicated items are identified, they are removed. This gives the same results Distinct method and Concat method.

Sample:

let set1 = ['A', 'a', 'B', 'C', 'D', 'D', 'E'];
let set2 = ['a', 'B', 'C', 'D', 'E', 'e', 'F'];
let union = set1.asEnumerable().union(set2, (a, b) => a.toLowerCase() === b.toLowerCase()).toArray();

console.log('Union method combines two list set1 and set2 as a unique list using comparer ...');
for (var index = 0; index < union.length; index++)
  console.log(union[index]);
Clone this wiki locally