Top "Linq" questions

Language Integrated Query (LINQ) is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages.

How to get index using LINQ?

Given a datasource like that: var c = new Car[] { new Car{ Color="Blue", Price=28000}, new Car{ Color="Red", Price=54000}, new …

c# .net linq c#-3.0
How to perform .Max() on a property of all objects in a collection and return the object with maximum value

I have a list of objects that have two int properties. The list is the output of another linq query. …

c# linq object max
Searching if value exists in a list of objects using Linq

Say I have a class Customer which has a property FirstName. Then I have a List<Customer>. Can …

c# linq
how to check if object already exists in a list

I have a list List<MyObject> myList and I am adding items to a list and I want …

c# linq list
Quickest way to compare two generic lists for differences

What is the quickest (and least resource intensive) to compare two massive (>50.000 items) and as a result have two …

c# linq list
Convert Linq Query Result to Dictionary

I want to add some rows to a database using Linq to SQL, but I want to make a "custom …

c# linq linq-to-sql todictionary
How do I concatenate two arrays in C#?

int[] x = new int [] { 1, 2, 3}; int[] y = new int [] { 4, 5 }; int[] z = // your answer here... Debug.Assert(z.SequenceEqual(new int[] { 1, 2, 3, 4, 5 })); Right …

c# arrays .net linq
How would you do a "not in" query with LINQ?

I have two collections which have property Email in both collections. I need to get a list of the items …

c# linq
LINQ query to select top five

I have a LINQ query: var list = from t in ctn.Items where t.DeliverySelection == true && t.Delivery.…

c# linq
LINQ .Any VS .Exists - What's the difference?

Using LINQ on collections, what is the difference between the following lines of code? if(!coll.Any(i => i.…

c# linq collections