I have a program where there is a topic (like a forum), people can react to that topic.
USER:
- id
- first name
- last name
TOPIC:
- id
- subject
REACTION:
- id
- topic_id
- content
Code:
List<USER> ListOfAllUsers = new List<USER>();
var AllReactions = from r in db.REACTIONs
where r.topic_id == _topic_id
select r;
foreach (var itemX in AllReactions)
{
ListOfAllUsers.Add(itemX.USER);
}
//Distinct the list of duplicates
var ListOfUsers = ListOfAllUsers.Distinct().ToList();
Now, the "distinct" list still has some duplicates, how do I distinct the list based on the user id's? Or maybe there is another better way to do this. Thanks in advance.