LINQ Interview Question #4

What is LINQ to Objects?

LINQ Fundamentals, Syntax, IEnumerable & IQueryable Junior Beginner

Quick Interview Answer

LINQ to Objects refers to using LINQ operators against in-memory collections that implement IEnumerable<T>. The query logic executes as .NET code in the application process.

Detailed Explanation

LINQ to Objects refers to using LINQ operators against in-memory collections that implement IEnumerable<T>. The query logic executes as .NET code in the application process.

Examples include querying arrays, List<T>, HashSet<T>, and other enumerable collections. There is no translation to SQL when using ordinary LINQ to Objects.

Code Example

var products = new List<Product>
{
    new() { Name = "Mouse", Price = 25 },
    new() { Name = "Keyboard", Price = 50 }
};

var result = products.Where(p => p.Price >= 30);