Skip to main content

Practice · 2 of 2

Callback Dispatch Table

CHALLENGE
Difficulty: intermediate+25 XP

Implement a command router backed by Action<string> callbacks. Register stores a callback under a name (re-registering REPLACES). Dispatch invokes the callback with a payload and returns true; unknown names return false without throwing. ``csharp static void Register(string name, Action<string> callback); static bool Dispatch(string name, string payload); ``

Back to lesson: Practice: Composition & Callback Practice