Break a String array of size 5 into two parts 2 & 3 string arrays?
Orignal
String Array[] = {"asjjsjamsssssssssssssssssssssss",
"hcb j m dnfijvkfkjvkjdffkbdfblllfl",
"bjbvfumfkkf md",
"jdsjvjsdjvjjjjdjjdj",
"bsdjdddddddddddddddddddddddd"}
Resulting String contains 2 & 3 strings.
Try this below.
string[] arr = {"asjjsjamsssssssssssssssssssssss",
"hcb j m dnfijvkfkjvkjdffkbdfblllfl",
"bjbvfumfkkf md",
"jdsjvjsdjvjjjjdjjdj",
"bsdjdddddddddddddddddddddddd"};
var first = arr.Take(2).ToArray();
var second = arr.Skip(2).Take(3).ToArray();
You will never be able to break string array unless the number of elements in array are even. Rethink about your operation.
"hcb md"
- Anders Lindahl 2012-04-04 06:49