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.

Linq - SelectMany Confusion

From what I understand from the documentation of SelectMany, one could use it to produce a (flattened) sequence of a 1…

c# linq data-structures linq-to-objects
Lambda Expression for join

public class CourseDetail { public CourseDetail(); public string CourseId { get; set; } public string CourseDescription { get; set; } public long CourseSer { get; set; } } …

c# lambda linq-to-objects
How can I filter a dictionary using LINQ and return it to a dictionary from the same type

I have the following dictionary: Dictionary<int,string> dic = new Dictionary<int,string>(); dic[1] = "A"; dic[2] = "…

c# linq dictionary linq-to-objects
Check if all items are the same in a List

I have a List(Of DateTime) items. How can I check if all the items are the same with a …

c# vb.net list linq-to-objects
How to update an element with a List using LINQ and C#

I have a list of objects and I'd like to update a particular member variable within one of the objects. …

c# .net linq ienumerable linq-to-objects
LINQ return items in a List that matches any Names (string) in another list

I have 2 lists. 1 is a collection of products. And the other is a collection of products in a shop. I …

c# linq linq-to-sql linq-to-objects
Conversion from Int array to string array

When I am converting array of integers to array of string, I am doing it in a lengthier way using …

c# .net arrays linq linq-to-objects
Use Where with .Select Linq

I have a scenario where i have to use .Select with where in LINQ. Below is my query. List<…

linq linq-to-objects
Code equivalent to the 'let' keyword in chained LINQ extension method calls

Using the C# compilers query comprehension features, you can write code like: var names = new string[] { "Dog", "Cat", "Giraffe", "Monkey", "…

c# linq extension-methods linq-to-objects
C# Linq where clause as a variable

I am trying to make a LINQ statement where the where clause comes from a variable. For example: string whereClause = …

c# linq linq-to-objects