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.

Select distinct by two properties in a list

I have a list<message> that contains properties of type Guid and DateTime (as well as other properties). …

c# list distinct linq-to-objects
C# Merging 2 dictionaries

I'm developing an app in C# targeting .NET 3.5. In it, I have 2 similar dictionaries that contain validation criteria for a …

c# dictionary linq-to-objects
Replacing nested foreach with LINQ; modify and update a property deep within

Consider the requirement to change a data member on one or more properties of an object that is 5 or 6 levels …

c# linq algorithm linq-to-objects
how to find the longest string in a string[] using LINQ

I have an array of strings of variable length. Currently I have a loop that iterates through the array to …

c# linq-to-objects
How to create a dynamic LINQ join extension method

There was a library of dynamic LINQ extensions methods released as a sample with Visual Studio 2008. I'd like to extend …

linq linq-to-sql c#-3.0 linq-to-entities linq-to-objects
With Entity Framework is it better to use .First() or .Take(1) for "TOP 1"?

We are implementing some EF data repositories, and we have some queries which would include TOP 1 I have read many …

sql linq entity-framework ienumerable linq-to-objects
Create a list of one object type from a list of another using Linq

If I have classes of Type A and B: public class A { public int TotalCount; public string Title; } public class …

linq linq-to-objects
Linq Group on Multiple Fields - VB.NET, Anonymous, Key

I am stumped. I need help. I have a DTO object with duplicates patient address data. I need to get …

vb.net linq linq-to-objects
Get a list of distinct items and their count

I have an object, that has many properties but the only two to worry about are: myobject.ID which is …

c# asp.net linq linq-to-objects
At least one object must implement IComparable

var listair = empcon.OrderBy(x => x.CustomerConnection.OrderBy(y => y.Id)).ToList(); When I am using this statement …

c# linq-to-objects