I'm trying to access an event which I have placed in a dictionary, I'd like to raise this event by selecting it from the dictionary. My event is defined as follows:
public static event EventHandler<SelectResultaatArgs> AddressSelected;
The dictionary looks as follows, which raises no build errors:
private Dictionary<string, Delegate> _eventIdentifiers = new() {
{ "AddressSelected", AddressSelected}
};
I have tried the following methods of accessing the event, both return null.
var r =_eventIdentifiers["AddressSelected"].GetMethodInfo();
and
var r =_eventIdentifiers["AddressSelected"];
I receive an event name from a different layer, which I want to use to raise a specific event from the dictionary, how could I assure that the result returned is not null?
Aucun commentaire:
Enregistrer un commentaire