Important C# Topics

LINQ

Query collections with expressive, composable operators.

Introduction

LINQ brings filtering, projection, ordering, grouping, and aggregation to strongly typed data.

Where filters values, OrderBy sorts them, and Select transforms each result. Execution occurs when the sequence is enumerated.

Runnable C# example

C#
Run code →
Program.cs
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var results = new[] { 7, 2, 9, 4, 6 }
            .Where(number => number % 2 == 0)
            .OrderBy(number => number)
            .Select(number => number * number);
        Console.WriteLine(string.Join(", ", results));
    }
}
Result of running the code
4, 16, 36

Practice with the debugger

Set a breakpoint on an important assignment or condition, click Debug, and inspect the local values before stepping to the next line.

Practice with a challenge

Use what this lesson covers to solve a real problem. Each challenge runs in your browser with instant tests and an AI review.

All challenges