C# Practice Exercises

Generic Task List

Manage typed task records with List<T>.

Introduction

Records and generic collections form a concise in-memory model.

FindAll returns matching tasks while preserving the strongly typed TaskItem objects.

See how it works

Use the buttons to change the list and watch the indices update. Move start and stop to see which items a slice takes.

Runnable C# example

C#
Run code →
Program.cs
using System;
using System.Collections.Generic;
record TaskItem(string Title, bool Done);
class Program
{
    static void Main()
    {
        var tasks = new List<TaskItem> { new("Learn LINQ", true), new("Learn events", false) };
        foreach (var task in tasks.FindAll(task => !task.Done)) Console.WriteLine(task.Title);
    }
}
Result of running the code
Learn events

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