Top "Linq" questions

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

LIKE operator in LINQ

Is there any way to compare strings in a C# LINQ expression similar to SQL's LIKE operator? Suppose I have …

c# linq sql-like
LINQ: "contains" and a Lambda query

I have a List<BuildingStatus> called buildingStatus. I'd like to check whether it contains a status whose char …

c# .net list linq lambda
Returning IEnumerable<T> vs. IQueryable<T>

What is the difference between returning IQueryable<T> vs. IEnumerable<T>, when should one be preferred …

c# linq linq-to-sql ienumerable iqueryable
Convert string[] to int[] in one line of code using LINQ

I have an array of integers in string form: var arr = new string[] { "1", "2", "3", "4" }; I need to an array of 'real' …

c# .net linq extension-methods
Linq Syntax - Selecting multiple columns

This is my Linq Syntax which I am using to my entity model IQueryable<string> objEmployee = null; objEmployee = …

c# linq entity-framework
Retrieving Property name from lambda expression

Is there a better way to get the Property name when passed in via a lambda expression? Here is what …

c# linq lambda expression-trees
Split List into Sublists with LINQ

Is there any way I can separate a List<SomeObject> into several separate lists of SomeObject, using the …

c# linq data-structures
How to check if IEnumerable is null or empty?

I love string.IsNullOrEmpty method. I'd love to have something that would allow the same functionality for IEnumerable. Is there …

c# .net linq collections ienumerable
Get all column names of a DataTable into string array using (LINQ/Predicate)

I know we can easily do this by a simple loop, but I want to persue this LINQ/Predicate? string[] …

c# .net linq datatable
How to perform Join between multiple tables in LINQ lambda

I am trying to perform a Join between multiple tables in LINQ. I have the following classes: Product {Id, ProdName, …

c# linq join lambda multiple-tables