c# - how to compare two list objects in fluent LINQ -
i have 2 lists have different type of objects
list<type1> list1 list<type2> list2 the common things between type1 , type2 id property , date property.
how list of items have both id , date property equal each other?
var list3 = list1.where(x=>x.id == ?? thanks
you can join on multiple fields, you'll need else store values in.
assuming other properties different between type1 , type2, you'll need third class stores information want keep.
var results = (from l1 in list1 join l2 in list2 on new { l1.id, l1.date} equals new { l2.id, l2.date } select new somethirdclass { });
Comments
Post a Comment