Top "Linq" questions

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

Multiple "order by" in LINQ

I have two tables, movies and categories, and I get an ordered list by categoryID first and then by Name. …

linq sql-order-by
Group By Multiple Columns

How can I do GroupBy Multiple Columns in LINQ Something similar to this in SQL: SELECT * FROM <TableName> …

c# .net linq group-by aggregate
When to use .First and when to use .FirstOrDefault with LINQ?

I've searched around and haven't really found a clear answer as to when you'd want to use .First and when …

c# .net linq
Check if list contains element that contains a string and get that element

While searching for an answer to this question, I've run into similar ones utilizing LINQ but I haven't been able …

c# .net linq list contains
C# Linq Group By on multiple columns

public class ConsolidatedChild { public string School { get; set; } public string Friend { get; set; } public string FavoriteColor { get; set; } public List&…

c# linq group-by aggregate
Update all objects in a collection using LINQ

Is there a way to do the following using LINQ? foreach (var c in collection) { c.PropertyToSet = value; } To clarify, …

c# .net linq foreach
Difference Between Select and SelectMany

I've been searching the difference between Select and SelectMany but I haven't been able to find a suitable answer. I …

c# linq-to-sql linq
LINQ equivalent of foreach for IEnumerable<T>

I'd like to do the equivalent of the following in LINQ, but I can't figure out how: IEnumerable<Item&…

linq foreach ienumerable
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
Where IN clause in LINQ

How to make a where in clause similar to one in SQL Server? I made one by myself but can …

c# linq