int maxShoeSize = Workers.Where(x => x.CompanyId == 8)
.Select(x => x.ShoeSize)
.DefaultIfEmpty(0)
.Max();
The zero in DefaultIfEmpty
is not necessary.
More Related Contents:
- How to convert an expression tree to a partial SQL query?
- Linq: help me to make this work
- How do I apply OrderBy on an IQueryable using a string column name within a generic extension method?
- Why is .Contains slow? Most efficient way to get multiple entities by primary key?
- Entity Framework/Linq EXpression converting from string to int
- Filter/Search using Multiple Fields – ASP.NET MVC
- Can I specify my explicit type comparator inline?
- What is the Efficiency and Performance of LINQ and Lambda Expression in .Net?
- Entity Framework – Cannot convert lambda expression to type ‘string’ because it is not a delegate type
- LINQ – Query syntax vs method chains & lambda [closed]
- Join and Include in Entity Framework
- Group by with multiple columns using lambda
- Remove item from list based on condition
- How to do an “in” query in entity framework?
- Keep Getting ‘The LINQ expression node type ‘Invoke’ is not supported in LINQ to Entities’ Exception
- Linq Query keeps throwing “Unable to create a constant value of type System.Object….”, Why?
- How to include() nested child entity in linq
- Should the order of LINQ query clauses affect Entity Framework performance?
- LINQ Query to Convert string to datetime
- Get All instead of FirstOrDefault
- How to write this nested foreach loop query in LINQ?
- Linq: GroupBy, Sum and Count
- How to compare only Date without Time in DateTime types in Linq to SQL with Entity Framework?
- Lambda variable capture in loop – what happens here? [duplicate]
- Extension methods syntax vs query syntax
- Internal .NET Framework Data Provider error 1025
- Should I use two “where” clauses or “&&” in my LINQ query?
- Entity Framework Code Only error: the model backing the context has changed since the database was created
- Performance of Find() vs. FirstOrDefault() [duplicate]
- Update records using LINQ