1
我有以下類:LINQ如何GROUPBY正確
class AssembledDTO
{
int pid,
int blockId,
List<string> references
}
我想組通過一切方式如下:
AssembledParts.GroupBy(entry => new
{
entry.PID,
entry.BlockId
}).
Select((key , val)=> new AssembledDTO
{
BlockId = key.Key.BlockId,
PID = key.Key.PID,
References = val.
})
在References
我想加在一起都references
名單我分組的每個羣組。
我該怎麼做?我在這裏想念什麼?
你試過'References = key.ToList()'嗎? – I4V
@ I4V我沒有看到那裏ToList() –
請不要重新發布! http://stackoverflow.com/q/16773147/861716替代編輯您的問題。 –