I have a list of dates:
List<DateTime> dates;
And I need those date values to be the ones in the following list that I am going to get ("x.Date" value).
var response = myObject
.Where(x => xUserId == userId
&& Date = x.Date == //this must be the dates values
.Select(x => new
{
x.Id,
x.Quantity,
x.Date
})
.OrderBy(x => x.Id)
.ToList();
>Solution :
Use Where
… Contains
:
var response = myObject
.Where(x => xUserId == userId && dates.Contains(x.Date))
...