There are a couple of ways you can do this:
1. Chain Where()s
You can chain together two Where()
statements, the first one with the OR and the second satisfying the AND. This can get to be really useful when you have a query that you're programmatically/dynamically building:
var output = input
.Where(a => a.State == "CA" || a.State == "TX")
.Where(a => a.FirstName == "John");
Since the Where()
filters are run in series, the effect is a logical AND of the conditions in each.
2. Parenthetical Logic
You can also just use parentheses to dictate the order of operation:
var output = input
.Where(a => (a.State == "CA" || a.State == "TX")
&& a.FirstName == "John");