Reputation: 1567
I have two list of class, for example :
public class ListA
{
public string FinAccCompleteCode { get; set; }
public string FinAccCompleteDesc { get; set; }
}
public class ListB
{
public string FinAccCompleteCode { get; set; }
public string FinAccCompleteCodeDesc { get; set; }
}
I'll get items of ListA where them exists in Class ListB, also i use the bellow code
db.ListA.Where(a => ListB.Any(t => t.FinAccCompleteCode == a.FinAccCompleteCode)).ToList();
but occure this error : Unable to create a constant value of type 'ListB'. Only primitive types or enumeration types are supported in this context.
Upvotes: 0
Views: 129
Reputation: 1567
I used bellow method
var result=db.ListA.Where(a => ListB.Contains(a.FinAccCompelteCode)).ToList();
I don't know , what is difrence between both code ?
Upvotes: 1