LINQ Searching Only Allowing Equivalency
- by Mad Halfling
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.