I have a dictionary, which i need to chunk to list of 9 dictionary item in a group and other 9 items in to next group and so on...,
Tried this code,
public static List<List<DictionaryEntry>> ChunkDict(Dictionary<string,string> theList, int chunkSize)
{
List<List<DictionaryEntry>> result = theList.Select((x, i) =>
new { data = x, indexgroup = i / chunkSize })
.GroupBy(x => x.indexgroup, x => x.data)
.Select(g => new List<DictionaryEntry>(g)).ToList();
return result;
}
But it is not compiling, got error: Error 398 The best overloaded method match for 'System.Collections.Generic.List.List(System.Collections.Generic.IEnumerable)' has some invalid arguments
How do i do this?