devxlogo

Pick the First Few Elements in an Array in C#

Pick the First Few Elements in an Array in C#

Using the Take operator, we can pick the first few elements of an array with a simple statement like this:

int n = 3;var firstThreeStates = states.Take(n);

devx-admin

Share the Post: