Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

split array into pieces of x length c#

static List<List<int>> SplitArray(List<int> originalArray, int chunkSize)
{
  var list = new List<List<int>>();
  var ls = new int[chunkSize];
  for (int i = 0; i <= originalArray.Count-chunkSize; i++)
  {
    originalArray.CopyTo(i, ls,0, chunkSize);
    list.Add(ls.ToList());
  }
  return list;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: Area Of the triangle with condition 
Csharp :: FileSystemEventHandler raised twice 
Csharp :: c# return default "" if null 
Csharp :: unity get layermask 
Csharp :: c# int array add number 
Csharp :: Prime number Upto n 
Csharp :: c# online code editor 
Csharp :: using c# 
Csharp :: list<string,string c# 
Csharp :: qrcode c# 
Csharp :: loop c# 
Csharp :: c# literals 
Csharp :: leantween move ui 
Csharp :: asp net core send email async 
Csharp :: c# code process to start any exe application 
Csharp :: how do i repeat a button on visual studio code 
Csharp :: come controllare se textbox è vuota c# 
Csharp :: Dominosteine c# 
Html :: html empty character 
Html :: how to open link in a new tab 
Html :: font awesome linkedin 
Html :: how to remove download option from video tag in html 
Html :: tabulation html 
Html :: how to set video speed html 
Html :: jquery integration 
Html :: html inbed youtube 
Html :: justify content 
Html :: html skype call 
Html :: html pi symbol 
Html :: indian phone pattern regex 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =