private TEventHandler GetHandler(Action <TEventArgs> onNext) { TEventHandler handler; if (_conversion is null) { handler = FastReflection.CreateDelegate <TEventHandler>(onNext, typeof(Action <TEventArgs>).GetMethod(nameof(Action <TEventArgs> .Invoke))); } else { handler = _conversion(onNext); } return(handler); }
private TEventHandler GetHandler(Action <EventPattern <TEventArgs> > onNext) { TEventHandler handler; if (_conversion == null) { Action <object, TEventArgs> h = (sender, eventArgs) => onNext(new EventPattern <TEventArgs>(sender, eventArgs)); handler = FastReflection.CreateDelegate <TEventHandler>(h, typeof(Action <object, TEventArgs>).GetMethod(nameof(Action <object, TEventArgs> .Invoke))); } else { handler = _conversion((sender, eventArgs) => onNext(new EventPattern <TEventArgs>(sender, eventArgs))); } return(handler); }