.Net List take union, intersection, difference

List <T> = List1 new new List <T> (); 
List <T> = List2 new new List <T> (); 

List <T> = List new new List <T> (); 

// and set, comprising 1, 2 all 
List = list1.Union (List2); 

// intersection, the same parts 1,2 
List = list1.Intersect (List2); 


// difference set, but in the presence of 1 2 does not exist in 
list = list1.Except (list2)

 

Guess you like

Origin www.cnblogs.com/61007257Steven/p/10953486.html