【发布时间】:2010-03-18 14:26:23
【问题描述】:
我不太明白为什么这个 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)。
谁能告诉我哪里出错了?
谢谢
【问题讨论】: