You get the error because your argument to
Except
has
long
values, as opposed to RateListCard, that holds
long?
s.
Do this:
ThirdList = RateCardList.Except(categoryList.Select(x => new long?(x)));
.Select(x => new long?(x))
takes all elements, calls the code to make them
long?
s and returns a new
IEnumerable<long?>
, which you can validly pass to
Except
.