2

How would I get all arguments after the first 3 from a string[] in C#?

E.g. from [1, 2, 3, 4, 5] I want [4, 5]

Petah
  • 44,167
  • 27
  • 153
  • 209
  • Related: [Getting a sub-array from an existing array](http://stackoverflow.com/questions/943635/c-sharp-arrays-getting-a-sub-array-from-an-existing-array) – Jonathan Lonowski Jun 20 '14 at 03:24

1 Answers1

5

Making sure you have using System.Linq, you can use this:

stringArray.Skip(3);

This returns an IEnumerable, which you can traverse. If you need an array, you can just:

stringArray.Skip(3).ToArray();
Adriano Carneiro
  • 55,739
  • 12
  • 86
  • 122