我不太明白为什么这个LINQ语句不能像我预期的那样工作:
Dim distinctSurchargesList = (From thisparent As Parent In ThisParentCollection _
From thisChild As Child In thisparent.theseChildren _
Select New With {.childId = thischild.Id}).Distinct()
我假设这将创建一个新的匿名类型集合,这将是不同的。相反,它创建一个“thisParentCollection”大小的集合,其中包含重复的“MyAnonymousType”(重复的ID)。
有人能告诉我哪里出了问题吗?
谢谢