Channels checkpoint
Challenge on lesson: Checkpoint: channels
CHALLENGE
Difficulty: advanced+25 XP
Implement static async Task<int> PumpAsync(ChannelReader<int> source, ChannelWriter<int> sink, int factor, CancellationToken ct) reading every item from source, writing item*factor to sink, and completing the sink when done โ propagating cancellation. Then implement static async Task<List<int>> RunBounded(int count): create a bounded channel (capacity 8), a producer writing 0..count-1 then completing, and a single consumer collecting via ReadAllAsync. The test verifies end-to-end flow and that the consumer's output is complete.
Press Submit to check your solution.
Back to lesson: Checkpoint: channels