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();
精彩评论