Thursday, May 4, 2017

Keep only the items in a list which to do not have dupes in a sister list and then merge the sister list and the truncated list into one master list without any dupes in C#.

Use LINQ, like so:

List<Om> thinYin = yinList.Result.Where(i => !yangList.Any(a => a.OmId ==
      i.OmId)).ToList();
List<Om> yinYang = yangList.Concat(thinYin).OrderBy(y => y.OmId).ToList();

No comments:

Post a Comment