Top "Linq-to-objects" questions

The term "LINQ to Objects" refers to the use of LINQ queries with any IEnumerable or IEnumerable<T> collection directly, without the use of an intermediate LINQ provider or API such as LINQ to SQL or LINQ to XML.

Sorting a list using Lambda/Linq to objects

I have the name of the "sort by property" in a string. I will need to use Lambda/Linq to …

c# linq lambda linq-to-objects
Linq select objects in list where exists IN (A,B,C)

I have a list of orders. I want to select orders based on a set of order statuses. So essentially …

c# linq list linq-to-objects exists
Remove duplicates in the list using linq

I have a class Items with properties (Id, Name, Code, Price). The List of Items is populated with duplicated items. …

c# linq linq-to-objects generic-list
Dynamic LINQ OrderBy on IEnumerable<T> / IQueryable<T>

I found an example in the VS2008 Examples for Dynamic LINQ that allows you to use a sql-like string (e.…

c# linq linq-to-objects
How can I get LINQ to return the object which has the max value for a given property?

If I have a class that looks like: public class Item { public int ClientID { get; set; } public int ID { get; …

c# linq linq-to-objects
Find() vs. Where().FirstOrDefault()

I often see people using Where.FirstOrDefault() to do a search and grab the first element. Why not just use …

c# linq linq-to-objects
Filtering lists using LINQ

I've got a list of People that are returned from an external app and I'm creating an exclusion list in …

c# linq list linq-to-objects
how to query LIST using linq

Suppose if I add person class instance to list and then I need to query the list using linq. List …

c# linq-to-objects
Using LINQ to group a list of objects

I have an object: public class Customer { public int ID { get; set; } public string Name { get; set; } public int GroupID { …

c# linq group-by linq-to-objects
Using LINQ, select list of objects inside another list of objects

public class ClassA { public string MyString {get; set;} } public class ClassB { public List<ClassA> MyObjects {get; set;} } List&…

c# linq select linq-to-objects