Skip to main content

Practice ยท 2 of 4

CountIf with a predicate

CHALLENGE
Difficulty: beginner+25 XP

Implement static int CountIf<T>(IEnumerable<T> items, Func<T, bool> predicate) counting matching elements; null items โ†’ 0.

Back to lesson: Practice: Generics workout