IEqualityComparer for anonymous type

后端 未结 3 1508
梦谈多话
梦谈多话 2020-12-05 04:55

I have this

 var n = ItemList.Select(s => new { s.Vchr, s.Id, s.Ctr, s.Vendor, s.Description, s.Invoice }).ToList();
 n.AddRange(OtherList.Select(s =>          


        
3条回答
  •  误落风尘
    2020-12-05 05:06

    Most of the time when you compare (for equality or sorting) you're interested in choosing the keys to compare by, not the equality or comparison method itself (this is the idea behind Python's list sort API).

    There's an example key equality comparer here.

提交回复
热议问题