TakeWhile

suggest change
var numbers = new[] {2,4,6,1,3,5,7,8};

var evenNumbers = numbers.TakeWhile(n => (n & 1) == 0);

Console.WriteLine(string.Join(",", evenNumbers.ToArray()));

//2,4,6

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents