Exercícios de C#

Generic Task List

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

How it works

Manage typed task records with List<T>.

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

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);
    }
}
Expected output
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.