我需要從兩個包含給定值的列表中檢索所有項目。需要合併兩個數據集合的幫助
例子:
var list1 = {
new Dummy(){ Name = "Dummy1", Number = 1 },
new Dummy(){ Name = "Dummy2", Number = 2 },
new Dummy(){ Name = "Dummy3", Number = 3 }
};
var list2 = {
new Dummy(){ Name = "Dummy4", Number = 4 },
new Dummy(){ Name = "Dummy5", Number = 2 },
new Dummy(){ Name = "Dummy6", Number = 6 }
};
var list3 = GetAllDummiesWithNumbersContainedInBothLists();
我想項目list3包含Dummy2和Dummy5,因爲兩者具有相同的號碼。
我該怎麼做?它應該很簡單,但我不知道它...
大資源,LINQ引用... HTTP://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx – 2010-10-20 19:28:13