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

Viewed 26679

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; }
}

IEnumerable<Values> values;
IEnumerable<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 IEnumerable<Holidays> 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.

5 Answers
Related