Matching Algorythm of Objects stored in Dictionaries

I have data in a ViewControlle available like this:

1x [Group] contains
N [User] have
N [Pets] (Dog, Rat, Cat and so on. Each User habe similar or different pets)

I want to find out which common Pet has the Group.

What my Code currently does:

Create a List of ALL Pets. Then get a list of all Unique Pets in the group. For this unique Pet, count the occurrence of every Item of the Unique in the ALL List. If the count is like the count of Users, I have a Match.

This code feels not right / and or stupid to me.

Is there a better way to achieve what I want?



Read more here: https://stackoverflow.com/questions/64899224/matching-algorythm-of-objects-stored-in-dictionaries

Content Attribution

This content was originally published by JohnDole at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: