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

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -