LINQ Searching Only Allowing Equivalency
Posted
by Mad Halfling
on Stack Overflow
See other posts from Stack Overflow
or by Mad Halfling
Published on 2010-04-29T10:34:44Z
Indexed on
2010/04/29
10:37 UTC
Read the original article
Hit count: 432
LINQ
|linq-to-sql
Hi folks, I'm trying to filter a set of records based on a sub-object's criteria. This compiles ok
recordList = recordList.Where(r => r.Areas.Where(a => a.Area == "Z").Count() > 0);
but this doesn't
recordList = recordList.Where(r => r.Areas.Where(a => a.Area <= "Z").Count() > 0);
giving these errors Cannot convert lambda expression to type 'string' because it is not a delegate type Delegate 'System.Func' does not take '1' arguments Operator '<=' cannot be applied to operands of type 'string' and 'string'
!= works ok, by any sort of less than or greater than operation fails.
© Stack Overflow or respective owner