开发者

Split a List of structs into sublists based on the stucts contents

I have a List that I need to split into sublists, one for each value of MyStruct.GroupingStrin开发者_运维知识库g. Can I do this via linq?


somelist.ToLookup(x => x.GroupingString)


List<List<StructType>> groupings = list.GroupBy(x => x.GroupingString)
                                       .Select(x => x.ToList()).ToList();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜