There is a static class in an external library that has a static event. Simplified to this:
internal static class Eventie {
public delegate void Something();
public static event Something OnSomething;
}
I need to get existing event handlers for it and call one of them from my code. Something like this:
List<Something> delegates = typeOf(Eventie).GetEventHandlersFor(nameof(OnSomething));
delegates.Where(...).ForEach(smth => smth.Invoke()); // pseudo code here
There is a solution that works for non static classes and I successfully used it for meddling with AppDomain.CurrentDomain.AssemblyResolve
event, but it takes an instance parameter which makes it impossible (afaik) to use with static class that I got.
Aucun commentaire:
Enregistrer un commentaire