public void Linq() {
List
List
var productFirstChars =
from prod in products
select prod.ProductName\[0\];
var customerFirstChars =
from cust in customers
select cust.CompanyName\[0\];
**var productOnlyFirstChars =** **productFirstChars.Except(customerFirstChars);**
//筛选表所有修改的数据(差集)(同样适用于DataTable)
//DataTable dtResult = dtAllData.AsEnumerable().Except(dtPartData.AsEnumerable());
Console.WriteLine("First letters from Product names, but not from Customer names:"); foreach (var ch in productOnlyFirstChars) { Console.WriteLine(ch); } }
手机扫一扫
移动阅读更方便
你可能感兴趣的文章