日期:2014-05-17  浏览次数:20823 次

如何求两个list的差集
 List<Product> products = new List<Product>(){
              new Product{Id=1},
              new Product{Id=2},
              new Product{Id=3},
              new Product{Id=4},
              new Product{Id=5},
              new Product{Id=6}, 
              new Product{Id=1},
              new Product{Id=7},            
              new Product{Id=8},
           
            };

             List<Product> product1 = new List<Product>(){
             new Product{Id=1},
             new Product{Id=7},           
             new Product{Id=8},
             new Product{Id=9},              
             new Product{Id=10},            
             new Product{Id=11}           
            };      
            


如果用这个的话
     List<Product> p1 = (from a in products                                
                                where !(from b in product1