How to compare 2 List objects to get the missing value from the List

前端 未结 5 742
走了就别回头了
走了就别回头了 2021-01-27 02:23

How do I use the \"NOT IN\" to get the missing data, to be added to \"foo\" List.

var accessories = new List(); 
var foo = new List()         


        
5条回答
  •  既然无缘
    2021-01-27 02:49

    If you just want foo to be the distinct combination of all elements in foo and accessories (i.e., the union of the two lists),

    List foo = foo.Union(accessories).ToList();
    

提交回复
热议问题