Contains on a list
Posted: Thu 04 Mar 2010 14:07
Is there anyway to do a contains on list (effectively 'where xxx in (1,2,4,6)') with a LINQ query in the following form?
e.g.
where TypeRestriction is a list of integers and there is a one to many relationship between table1 and table2.
e.g.
Code: Select all
var query = from table1 in entity.Table1
from table2 in documentHead.Table2
where table1.InternalType.Contains(TypeRestriction)
orderby table2.StampRevision descending
select new
{
table1.OIDTable1,
table2.OIDTable2,
table2.Description,
table1.Extension,
max = table1.Table2.Max(x => x.OIDTable2)
};