Group sample employees by department and print counts.
Toolliyo Coach
Progressive help: Nudge → Guide → Approach. Full solution stays behind the Solution tab.
Editor is open — no login wall to practice.
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
using System.Linq;
class Program
{
static void Main()
{
var employees = new[] {
new { Name = "A", Dept = "IT" },
new { Name = "B", Dept = "HR" },
new { Name = "C", Dept = "IT" }
};
var groups = employees.GroupBy(e => e.Dept);
foreach (var g in groups)
Console.WriteLine($"{g.Key}: {g.Count()}");
}
}
Prefer Coach (Nudge → Guide → Approach) before revealing. No forced signup.
GroupBy mirrors SQL GROUP BY—essential for enterprise .NET roles.
Sign in to save and review your submission history. You can still Run code on the Editor tab as a guest.
Sign in