Generic types and inheritance
Hello,
I am trying to implement a basic event bus to have a single point for subscribing and publishing events and keeping clients anonymous from each others.
However I am having trouble defining type genericity for my event objects.
Attached file is the complete code extract.
The issue is raised at line 53 in
I am getting this error :
I don't know if I should look around improving the type constraints or if my
Any help would be much appreciated
----
Full code extract below :
I am trying to implement a basic event bus to have a single point for subscribing and publishing events and keeping clients anonymous from each others.
However I am having trouble defining type genericity for my event objects.
Attached file is the complete code extract.
The issue is raised at line 53 in
subscribe() method when I try to add the event handler to my collection.I am getting this error :
Argument 1: cannot convert from 'TEventHandler' to 'Events.IEventHandler<Events.Event>' (CS1503)I don't know if I should look around improving the type constraints or if my
_subjects dictionary should be typed differently.Any help would be much appreciated
----
Full code extract below :
Events.cs2.39KB
