I have a method that limits the items in a list via LINQ. The list contains items with two boolean properties: bool_a and bool_b. The list contains items where bool_a is true and bool_b is false as well as items where both are false.
My expectation is that once I have limited the list only records where bool_a is false will remain while all items where both bool_a and bool_b are false will be removed. However, I'm finding that all items are being removed. It's as though the AND operator is behaving like an OR.
An example follows. What am I not seeing?
var records = GetRecords();
var count_where_a_before = records .Where(x => x.bool_a); // 100 items
var count_where_ab_before = records .Where(x => x.bool_a && x.bool_b); // 10 items
records = records.Where(x => !x.bool_a && !x.bool_b);
var count_where_a_after = records .Where(x => x.bool_a); // 0 items
As you can see from the above, I've been using counts before and after the where clause to evaluate the list.