protected virtual void OnProtocolAbort(AbortEventArgs e) { AbortEventHandler temp = ProtocolAbort; if (temp != null) { temp(this, e); } }
// Wrap event invocations inside a protected virtual method protected virtual void OnAbortEventHandler(AbortEventArgs e) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. AbortEventHandler?.Invoke(this, e); // LogEventHandler thisEvent = ThisEvent; //assign the event to a local variable // If(thisEvent != null) // { // thisEvent(this, args); // } }