linq c# where in list code example
Example 1: linq where in list
var allowedStatus = new[]{ "A", "B", "C" };
var filteredOrders = orders.Order.Where(o => allowedStatus.Contains(o.StatusCode));
Example 2: from where in list linq
var filteredOrders = from order in orders.Order
where allowedStatus.Contains(order.StatusCode)
select order;