【发布时间】:2009-07-01 22:09:26
【问题描述】:
我有这个
var n = ItemList.Select(s => new { s.Vchr, s.Id, s.Ctr, s.Vendor, s.Description, s.Invoice }).ToList();
n.AddRange(OtherList.Select(s => new { s.Vchr, s.Id, s.Ctr, s.Vendor, s.Description, s.Invoice }).ToList(););
如果允许,我愿意这样做
n = n.Distinct((x, y) => x.Vchr == y.Vchr)).ToList();
我尝试使用通用 LambdaComparer,但由于我使用匿名类型,因此没有与之关联的类型。
“帮帮我欧比旺克诺比,你是我唯一的希望”
【问题讨论】:
-
好问题,我只是在寻找同样的东西。令人难以置信的是它不在标准库中。
标签: linq lambda anonymous-types iequalitycomparer