Why do EventTopics require method names?

Topics: CAB & Smart Client Software Factory
Nov 17, 2006 at 7:11 AM
originally posted by: LazzaG

Why on earth does the EventTopic require me to add a subscription using the method name as a string? As in:

EventTopic eventTopic = _rootWorkItem.EventTopics"MYTOPIC";
eventTopic.AddSubscription(this, "ProgrammaticHandler", null, ThreadOption.UserInterface);

This is a terrible coding practice. Even if the supporting classes use a similiar mechanism internally it should not be exposed to coders. Something using delegates would have been far more suitable, and esstentially already exists, for example when adding services.

Do this rather:

EventTopic <string> eventTopic = _rootWorkItem.EventTopics.Get<string>("MYTOPIC");
eventTopic .AddSubscription(new EventHandler<EventArgs<string>>(ProgrammaticHandler));