public void RemoveEventHandler(T handler) { if (handler == null) { return; } Dictionary <EventRegistrationToken, T> tokens = this.m_tokens; lock (tokens) { EventRegistrationToken preferredToken = EventRegistrationTokenTable <T> .GetPreferredToken(handler); T t; if (this.m_tokens.TryGetValue(preferredToken, out t) && t == handler) { this.RemoveEventHandlerNoLock(preferredToken); } else { foreach (KeyValuePair <EventRegistrationToken, T> keyValuePair in this.m_tokens) { if (keyValuePair.Value == (T)((object)handler)) { this.RemoveEventHandlerNoLock(keyValuePair.Key); break; } } } } }
public void RemoveEventHandler(T handler) { if ((object)handler == null) { return; } lock (this.m_tokens) { EventRegistrationToken local_2 = EventRegistrationTokenTable <T> .GetPreferredToken(handler); T local_3; if (this.m_tokens.TryGetValue(local_2, out local_3) && (object)local_3 == (object)handler) { this.RemoveEventHandlerNoLock(local_2); } else { foreach (KeyValuePair <EventRegistrationToken, T> item_0 in this.m_tokens) { if ((object)item_0.Value == (object)handler) { this.RemoveEventHandlerNoLock(item_0.Key); break; } } } } }
private EventRegistrationToken AddEventHandlerNoLock(T handler) { EventRegistrationToken key = EventRegistrationTokenTable <T> .GetPreferredToken(handler); while (this.m_tokens.ContainsKey(key)) { key = new EventRegistrationToken(key.Value + 1UL); } this.m_tokens[key] = handler; this.m_invokeList = (T)Delegate.Combine((Delegate)(object)this.m_invokeList, (Delegate)(object)handler); return(key); }
// Token: 0x0600635E RID: 25438 RVA: 0x00151CD4 File Offset: 0x0014FED4 private EventRegistrationToken AddEventHandlerNoLock(T handler) { EventRegistrationToken preferredToken = EventRegistrationTokenTable <T> .GetPreferredToken(handler); while (this.m_tokens.ContainsKey(preferredToken)) { preferredToken = new EventRegistrationToken(preferredToken.Value + 1UL); } this.m_tokens[preferredToken] = handler; Delegate @delegate = (Delegate)((object)this.m_invokeList); @delegate = Delegate.Combine(@delegate, (Delegate)((object)handler)); this.m_invokeList = (T)((object)@delegate); return(preferredToken); }