The distinct overload with no parameters uses the default equality comparer. For an anonymous type, the default equality comparer compares based on all public properties. In your case both the ContactId and the TicketNumber are used
to determine if the results are distinct.
In your screenshot the results show the same ContactId each time, but a different TicketNumber - so they are distinct.
If you only 1 result per contact then you have 2 options:
- Do not include the TicketNumber in the results.
- Use a custom equality comparer that ignores the TicketNumber. This will give you each contact once, with the TicketNumber from one of the resolved cases linked to that contact. See
this article on MSDN for using Distinct with a custom equality comparer.