Esercizi C#

Debug a LINQ Filter

Set a breakpoint inside IsPassing to observe how LINQ evaluates each score.

How it works

Inspect predicate inputs and verify a corrected LINQ condition.

The passing boundary is inclusive, so the predicate must use >= rather than >.

Runnable C# example

C#
Run code →
Program.cs
using System;
using System.Linq;
class Program
{
    static bool IsPassing(int score) => score >= 70;
    static void Main()
    {
        int[] scores = { 69, 70, 71 };
        var passing = scores.Where(IsPassing);
        Console.WriteLine(string.Join(", ", passing));
    }
}
Expected output
70, 71

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.