The simplest way is to use LINQ2Objects
var fromArr = arr.Skip(2).Take(5).ToArray();
The most performant way would be to use Array.Copy
, but that code would be much more cumbersome to write and you need to figure that out yourself, including handling all edge cases when the arrays are not long enough etc.
But if you will use the result just a few times you don't need to copy it back to an array, you can just use the lazy evaluation feature of LINQ2SQL
IEnumerable<string> fromArr = arr.Skip(2).Take(5);
then you can use fromArr
in a loop or whatever without even copying the data in the first place.
When I think about it you may have the option to use ArraySegment<string>
too instead of copying to new arrays.
But for the readability and simplicity, stick with the LINQ version unless you have a real reason to use another alternative.