var group = countylist.GroupJoin( list, (countyinfo l1) => new { l1.Countycode }, (Result l2) => new { l2.Countycode }, (item1, item2) => new { item1, item2 }) //2列表left jion .SelectMany(p => p.item2.DefaultIfEmpty(), (p, l2) => new { countyId=p.item1.Countycode, 地区= p.item1.Countyname, //countyname = l2 == null ? string.Empty : l2.Countyname, 低 = p.item2.Count(n => n.FX == "低"), 合计 = p.item2.Count() }).Distinct().ToList();
参考:
https://www.cnblogs.com/zitjubiz/p/a-left-outer-join-using-linq-extension-methods.html