Skip to main content

Practice · 4 of 4

A tiny event bus

CHALLENGE
Difficulty: beginner+25 XP

Implement nested class Solution.EventBus: event Action<string>? OnMessage;, void Publish(string message) (invokes subscribers with the message; safe when none), void Subscribe(Action<string> handler), void Unsubscribe(Action<string> handler). Subscribers run in subscription order.

Back to lesson: Practice: Delegates workout