How can I get LINQ to return the object which has the max value for a given property? [duplicate]

This question already has answers here: How to perform .Max() on a property of all objects in a collection and return the object with maximum value [duplicate] (9 answers) How to use LINQ to select object with minimum or maximum property value (19 answers) Closed 6 years ago. If I have a class that looks … Read more

Learning about LINQ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 3 years ago. Improve this question Overview One of the things I’ve … Read more

LINQ-to-SQL vs stored procedures? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

Find() vs. Where().FirstOrDefault()

I often see people using Where.FirstOrDefault() to do a search and grab the first element. Why not just use Find()? Is there an advantage to the other? I couldn’t tell a difference. namespace LinqFindVsWhere { class Program { static void Main(string[] args) { List<string> list = new List<string>(); list.AddRange(new string[] { “item1”, “item2”, “item3”, “item4” … Read more

LINQ Contains Case Insensitive

This code is case sensitive, how to make it case insensitive? public IQueryable<FACILITY_ITEM> GetFacilityItemRootByDescription(string description) { return this.ObjectContext.FACILITY_ITEM.Where(fi => fi.DESCRIPTION.Contains(description)); } 11 Answers 11

Entity framework linq query Include() multiple children entities

This may be a really elementry question but whats a nice way to include multiple children entities when writing a query that spans THREE levels (or more)? i.e. I have 4 tables: Company, Employee, Employee_Car and Employee_Country Company has a 1:m relationship with Employee. Employee has a 1:m relationship with both Employee_Car and Employee_Country. If … Read more