Joining on multiple fields in LINQ

It’s possible to join on multiple fields in LINQ using anonymous type

from item1 in data

join item2 in data

on new {item1.field1, item1.field2} equals new {item2.field1, item2.field2}

select new {

Field1 = item1.field1,

Field2 = item2.field2

}

Leave a Reply

Your email address will not be published. Required fields are marked *