c# - How i can split comma separated string in a group using LINQ -


i have string of comma separated ids 1,2,3,4,5,6,7,8,9...... etc.

please suggest how can split them in group of "quantity" means if quantity=3 group (list) ["1,2,3"], ["4,5,6"], ["7,8,9"] etc.

range of quantity 1-75.

try this:

var quantity = 3;   yourlist.select((x, i) => new { index = i, value = x })         .groupby(x => x.index / quantity )         .select(x => x.select(v => v.value).tolist())         .tolist(); 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -