[Solved] Linq – Where().Where() is AND or OR?


This is the same as doing two separated operations:

var numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

var biggerThanThree = numbers.Where(x => x > 3); // [4, 5, 6, 7, 8, 9, 10]

var smallerThanSeven = biggerThanThree.Where(x => x < 7); // [4, 5, 6]

I’m not going into lazy execution here, to keep things simple.

But the second .Where operates on the list already filtered by the first .Where, so it acts as an AND

solved Linq – Where().Where() is AND or OR?