Debug a LINQ Filter
Inspect predicate inputs and verify a corrected LINQ condition.
Introduction
Set a breakpoint inside IsPassing to observe how LINQ evaluates each score.
The passing boundary is inclusive, so the predicate must use >= rather than >.
Runnable C# example
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));
}
}
70, 71Practice 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