Split a spread by list of indices

not sure I understand your problem but does this help?

the GroupBy region allows you to tell how you want your stuff to be grouped. in this case we say we want to group based on the first three characters of the string. one might want to make something more sophisticated to make sure you’re dealing with numbers (yesyesregex) but this is just to demo the principle :)

then about the double foreach in the end… I don’t know really understand why we have to do it like that, but the splicer of the first foreach gives gives us a Grouping<T, T>, and the nodebrowser only allows us to access the Key, which is not what we want… so after having a look in MSDN there was this snippet :

foreach (var group in query)  
{  
    Console.WriteLine(group.Key == 0 ? "\nEven numbers:" : "\nOdd numbers:");  
    foreach (int i in group)  
        Console.WriteLine(i);  
}  

which translates to our nested foreach here, and allows us to access the elements of our groups.

edit well I guess since Grouping<T,T> is Enumerable then we are allowed to iterate over it with a foreach and access its elements, but yeah this is not really obvious :)

3 Likes