Skip to content
Learn Netverks

Lesson

Step 10/36 28% through track

collections-linq-intro

Collections and LINQ intro

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~1 min
Level
beginner

This lesson

An orientation to the ASP.NET track—how the server playground works, core vocabulary, and what you will practice next.

You need a clear map of the ASP.NET track so middleware, dependency injection, and the .NET project layout do not feel like magic.

You will apply Collections and LINQ intro in contexts like: Line-of-business APIs, intranets, BFF layers, and cloud-hosted services on Linux or Windows.

Write C# (top-level or Program class), click Run on server—the dev runner uses dotnet build/run on a temp net8 project (requires .NET SDK; LEARNING_RUNNER_ENABLED=true). Also read the interview prep blocks.

After HTML fundamentals and basic programming concepts—before or alongside SQL.

LINQ (Language Integrated Query) filters, projects, and aggregates collections—the same mental model as EF Core queries against databases. Playground code uses System.Linq; EF translates similar expressions to SQL.

Common operators

  • Where — filter (.Where(u => u.Active))
  • Select — project/shape (.Select(u => u.Email))
  • OrderBy / ThenBy — sorting
  • FirstOrDefault — single item or default
  • Any / Count — existence and counts

Deferred vs immediate

LINQ to Objects runs in memory when enumerated. EF Core LINQ builds SQL and executes at the database—avoid pulling entire tables into memory with careless ToList() before filtering.

Important interview questions and answers

  1. Q: LINQ to Objects vs EF Core?
    A: Same syntax; EF translates to SQL server-side, LINQ to Objects runs in CLR memory.
  2. Q: First vs Single?
    A: First takes first match; Single throws if zero or more than one—use when uniqueness is required.

Self-check

  1. Write a LINQ chain that filters then projects names.
  2. Why filter before ToList() in EF queries?

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • IEnumerable lazy?
  • Select vs Where?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump