How to get duplicate items for specific Ids?

Asked

Viewed 29 times

0

How do I get the list of repeating items with the same fpId and eclId?

var lst = (from fp in FPIds
        from et in ETIds
        from ec in ECIds
        join eclp in ECLP on ec equals eclp.ecId
        join ecl in ECL on eclpId equals clId                                   
        select new  {
                fpId = fp,
                etId = et,
                ecId = ec,
                eclId  
        }).ToList();
  • 1

    I recommend you do not shorten variable names, it leaves the code very confusing for those reading.

1 answer

1


I managed to solve this way, posted as an answer, because it can help other people. Thank you!

if (lst.GroupBy(p => new { p.fpId, p.eclId })
       .Where(x => x.Count() > 1)
       .Sum(x => x.Count()) == 0){

                }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.