IEnumerable<type> does not contain a definition of 'Contains'

I have 2 classes and 2 IEnumerable lists of those classes:

public class Values
{
    public int value {get;set;}
    public DateTime someDate {get;set;}
}

public class Holidays
{
    public DateTime holiday {get;set;}
}

IEnumberable<Values> values;
IEnumberable<Holidays> holidays;

Next, I am trying to select those 'values' where 'someDate' is not in 'holidays'

var query = values.Where(x=> !holidays.Contains(x.someDate));

However, this gives me the error of IEenumerable does not contain a definition of 'Contains'.

System.Linq is already added in the usings.

I believe this has to do something with the collections, but am not able to figure what.

Jon Skeet
people
quotationmark

As an alternative to what everyone else has suggested already:

var holidayDates = new HashSet<DateTime>(holidays.Select(h => h.holiday));
var query = values.Where(x => !holidayDates.Contains(x.someDate));

In particular, if you have a lot of holidays, this change will make the per-value check much more efficient.

people

See more on this question at Stackoverflow