Edit: The problem is not with distinct method but how Title is coded. Comparising with StringComparison.InvariantCultureIgnoreCase retruns true. Problem closed. Here is my code:
var b = ret.DistinctBy(x => new { x.Title, x.Type }).ToList();
When I run this line with my input I get this. I want to eliminate duplicates based on Title and Type. Can you tell me where I make a mistake? Aren't these 2 objects the same based on my comparison?
Thanks
Edit: Did more debugging. It appears that the names are different.
var z = ret[0].Title == ret[1].Title;
Checked with text comparer. It is the same. Any ideas why? I read MyClippings from Kindle. Will test if they code Title differently.
Can you share a little more code i.e the Class using my example below it works correctly:
Outputs:
Book A
Runnable Version: https://dotnetfiddle.net/gi8z7j
If you change the second
Book A
toBook B
it outputs: