2010-06-02 8 views

Respuesta

26

¿Has probado Enumerable.Except?

setB.Except(setA) 

Ejemplo:

HashSet<int> setB = new HashSet<int> { 1, 2, 3, 4, 5 }; 
HashSet<int> setA = new HashSet<int> { 1, 3, 5, 7 }; 
HashSet<int> result = new HashSet<int>(setB.Except(setA)); 

foreach (int x in result) 
    Console.WriteLine(x); 

Resultado:

 
2 
4 
+0

gracias tanto !!! – SFun28

Cuestiones relacionadas