如何将以下内容转换为单行内容?我知道这是可能的,但我似乎无法想到又如何。可能使用selectmany?
Dim claimIds = allClaimLineItems.Select(Function(i) i.ClaimLineItemId).Distinct()
For Each id As Guid In claimIds
Result.ClaimDuplicateItemRuleDataList.Add(GetClaimDuplicateItemRuleDataWithHighestDuplicateFlags(allClaimLineItems.Where(Function(i) i.ClaimLineItemId = id)))
Next
谢谢!
答案 0 :(得分:1)
var result = allClaimLineItems
.Select(i => i.ClaimLineItemId)
.Distinct()
.GroupJoin(allClaimLineItems, g => g, i => i.ClaimLineId, (g, matches) => matches)
.Select(GetClaimDuplicateItemRuleDataWithHighestDuplicateFlags)
.ToList();