2011-03-16 61 views

回答

6

IEnumerable<T>.Except

var a = new int[] {1, 2, 3, 4, 5}; 
var b = new int[] {4, 5, 6, 7, 8}; 
var c = a.Except(b); 
foreach(var x in c) 
    Console.WriteLine(x); 

輸出:

1 
2 
3 
2

是的。它被稱爲Except

你的情況

所以,C = A.Except(B);

2

,這將是Except(假設AB是枚舉):

var C = A.Except(B); 
相關問題