1
對我來說,這似乎是except和intersect操作的順序總是可以忽略的?
var list = new List<int>();
// list.Add some elements...
list.Except(anotherList).Intersect(yetAnotherList)
任何操作是這樣的總是相同的,如:
list.Intersect(yetAnotherList).Except(anotherList)
我不是100%肯定。
感謝您的幫助。
也許應該注意的是'Intesect'和'Except'都保留了元素的原始順序 - 因此兩個版本都會產生相同的結果。 – decPL 2014-11-04 15:09:28
你的第二句話是不正確的....一種奇怪的方式來說它。我認爲你的意思是你得到了一個清單,其中包含了yetAnotherList中的所有元素,但沒有列出anotherList中的所有元素。 – Kaz 2014-11-04 15:11:55
@Joey「如果yetAnotherList中沒有所有元素,並且沒有不在yetAnotherList中的所有元素」將不會產生任何結果。 – Kaz 2014-11-04 15:20:42