You can use .Take(int)
that takes just a certain part of the array. For example: myArray.Take(50)
will take the first 50 elements of the array myArray
.
After taking the first 50 elements, if you want to take the next 50 elements, you need to add an offset using the .Skip(int)
method that will skip a certain number of elements in the array. For example, myArray.Skip(20).Take(50)
will return the elements with index 20 to 49 of the array myArray
.
Therefore, if you want to split an array of for equals part of 50 characters you need to to this:
char[] part1 = myArray.Take(50).ToArray(); // Elements 0 to 49
char[] part2 = myArray.Skip(50).Take(50).ToArray(); // Elements 50 to 99
char[] part3 = myArray.Skip(100).Take(50).ToArray(); // Elements 100 to 149
char[] part4 = myArray.Skip(150).Take(50).ToArray(); // Elements 150 to 199
Split()
and Take()
are Linq commands and change the array into an IEnumerable. The ToArray()
after the Take(50) is to put it back in an array format. For more info about Linq: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/introduction-to-linq-queries