score:2
Accepted answer
var employees = employeeList.Where(o => o.PastSalaries.Any(p => p < 35000));
The parameter to the delegate is now a double, not a Salary
type with an Amount
property, so you can compare on the parameter directly.
score:1
var employees = employeeList.Where(o => o.PastSalaries.Any(p=>p < 35000));
Try this. In first case your type is Salary
and you check Amount
field of that type.
In this case you want to check double
value ,so p<35000
will work properly.
Source: stackoverflow.com
Related Articles
- Linq sub collection criteria where collection is a list of doubles
- LINQ WHERE method alters source collection
- LINQ to EF - Find records where string property of a child collection at least partially matches all records in a list of strings
- C# - Linq optimize code with List and Where clause
- Linq - Get all keys from dictionary where all values in the value list are equal to criteria
- How to execute a linq query for each item in a list , use it in the where clause and return a collection from the result of each query?
- c# Linq or code to extract groups from a single list of source data
- Count the occurrences of an object in a list where multiple criteria are matching using LINQ
- Using linq to instantiate objects containing lists of other objects, where query criteria is on inner list
- Filter ICollection of objects where any criteria matches the ones from a list of ints usin Linq
- Linq select objects in list where exists IN (A,B,C)
- linq where list contains any in list
- LINQ to SQL Where Clause Optional Criteria
- C# LINQ select from where value is not contained in array / list
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Linq Query Dictionary where value in List
- Checking if list of Tuple contains a tuple where Item1 = x using Linq
- LINQ Where clause with Contains where the list has complex object
- Where clause in Linq in List c#
- LINQ select List where sub-list contains item from another list
- C# predicate list passed to Linq Where clause
- LINQ query to split an ordered list into sublists of contiguous points by some criteria
- Where can I view LINQ source code?
- Return an empty collection when Linq where returns nothing
- Linq to entities - SQL Query - Where list contains object with 2 properties (or more)
- LINQ Source Code Available
- Simple SELECT WHERE LINQ Query to a list
- linq where contains ALL items in list
- linq remove items from query where any list value is present
- Linq with where clause in many-to-many EF Code First object
- Select all fields from collection with related items in another collection using LINQ
- Filter (Triple) Nested Collection using Linq C#
- Inner Join Using Lambda (LINQ)
- C# and displaying a row randomly for a sight word game
- Linq to XML querying an XDoc
- Using LINQ Distinct in C#
- Getting Values From XML With Linq Query
- How do I remove duplicate code in the query?
- Generate missing list values in c# list using Linq
- C# - datagridview doesn't show query result
- Iterate through Linq to Entities results until condition is met
- Get numerical data from a tab-separated text file and store them in a list
- Order complex object via LINQ
- How to convert img url to BASE64 string in HTML on one method chain by using LINQ or Rx
- .net c sharp LINQ : return Object utilization
- How to compare two lists on a combination of two properties and select a row which has mismatch in the third property?
- Reactive Extensions clean up
- Group by with a select statement with Distinct list of Strings
- Mongodb returns more than one result when using Take(1)
- Filtering in LINQ