Page 1 of 1

Contains on a list

Posted: Thu 04 Mar 2010 14:07
by damon.cognito
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.

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)
            };
where TypeRestriction is a list of integers and there is a one to many relationship between table1 and table2.

Posted: Tue 09 Mar 2010 10:50
by AndreyR
This topic was already discussed here:
http://www.devart.com/forums/viewtopic.php?p=41997