✅ how to remove duplicates?
I have the following method for preparing a dataset. The problem is that I receive territory ids and use them to group and form the dataset. For some reason, if multiple ids are passed at once and the data has something in common, it gets duplicated: accessGroup.Id, accessGroup.Title, accessGroup.Description. Please help me understand where the mistake is.
group:
4 Replies
SelectMany doesn't guarantee uniqueness...
soo what to do?
hm I can do smth like this
.DistinctBy( x => new { x.Compositions.TerritoryId, x.Id, x.Title, x.Description } )
is it a right solution?
idk, does it work?
yes