LINQ Interview Question #1

What is LINQ in C#?

LINQ Fundamentals, Syntax, IEnumerable & IQueryable Junior Beginner

Quick Interview Answer

LINQ stands for Language Integrated Query. It is a set of C# language features and .NET APIs that lets developers query, filter, transform, group, order, and aggregate data using a consistent syntax.

Detailed Explanation

LINQ stands for Language Integrated Query. It is a set of C# language features and .NET APIs that lets developers query, filter, transform, group, order, and aggregate data using a consistent syntax.

LINQ can work with in-memory collections, databases through providers such as Entity Framework Core, XML, and other queryable data sources. The actual execution behavior depends on the source and LINQ provider.

Code Example

int[] numbers = { 1, 2, 3, 4, 5 };

var evenNumbers = numbers
    .Where(n => n % 2 == 0)
    .ToList();