Practice ยท 3 of 4
Retry with attempt budget
CHALLENGE
Difficulty: beginner+25 XP
Implement static int ReadWithRetry(Func<int> reader, int attempts): calls reader() until it succeeds (returns its value) or the attempts run out โ then throws InvalidOperationException. Counts every attempt, including the successful one. attempts <= 0 โ ArgumentException without calling reader.
Press Submit to check your solution.
Back to lesson: Practice: Error handling workout