Linq to object - Select Distinct
- by Ben
Hi,
I can't quite figure out why this Linq Statement isn't working as i would expect:
Dim distinctSurchargesList = (From thisparent As Parent In ThisParentCollection _
From thisChild As Child In thisparent.theseChildren _
Select New With {.childId = thischild.Id}).Distinct()
I would assume that this would create a new collection of anonymous types, that would be distinct. Instead it creates a collection the size of the "ThisParentCollection" with duplicate "MyAnonymousType" in it (duplicate id's).
Can anyone tell me where im going wrong?
Thanks