Afternoon,
I need to split an array into smaller "chunks".
I am passing over about 1200 items, and need to split these into easier to handle arrays of 100 items each, which I then need to process.
Could anyone please make some suggestions?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
LINQto group all items by the chunk size and create new Arrays afterwards.Note that it’s not necessary to create new arrays(needs cpu cycles and memory). You could also use the
IEnumerable<IEnumerable<String>>when you omit the twoToArrays.Here’s the running code: http://ideone.com/K7Hn2