我怎样才能使这个 Distinct 工作:
var blockIdMap = (from panelEntry in panelEntries
select new {panelEntry.BlockNo, panelEntry.BlockID})
.Distinct()
.ToDictionary(mc => mc.BlockNo , mc => mc.BlockID);
我只需要 BlockNo 的唯一条目及其 BlockId,因为我将它们输入到 Dictionary 并且 BlockNo 应该是唯一的。我只想拿第一个。