Practice · 1 of 5
Sequential vs Concurrent: Prove It
CHALLENGE
Difficulty: intermediate+25 XP
Two ways to await three simulated fetches. SumSequential awaits one at a time; SumConcurrent starts all three, then awaits together. The simulator logs an event per transition — prove the difference by EVENT ORDER, not the clock:
``csharp
public sealed class EventIo
{
public EventIo(); // provided
public List<string> Log { get; } // "start:N" / "done:N" entries
public Task<int> FetchAsync(int step); // provided: logs start, yields, logs done
}
static Task<int> SumSequential(EventIo io); // sum of steps+1
static Task<int> SumConcurrent(EventIo io); // same total, different order
``
Press Submit to check your solution.
Back to lesson: Practice: Async Practice: Fetch, Fan-out, Cancel