/// <summary>Removes an element from the invocation list of this <see cref="T:System.MulticastDelegate" /> that is equal to the specified delegate.</summary> /// <returns>If <paramref name="value" /> is found in the invocation list for this instance, then a new <see cref="T:System.Delegate" /> without <paramref name="value" /> in its invocation list; otherwise, this instance with its original invocation list.</returns> /// <param name="value">The delegate to search for in the invocation list. </param> /// <exception cref="T:System.MemberAccessException">Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism. </exception> protected sealed override Delegate RemoveImpl(Delegate value) { if (value == null) { return(this); } MulticastDelegate multicastDelegate2; MulticastDelegate multicastDelegate = MulticastDelegate.KPM((MulticastDelegate)value, this, out multicastDelegate2); if (multicastDelegate == null) { return(this); } MulticastDelegate multicastDelegate3 = null; MulticastDelegate result = null; for (MulticastDelegate multicastDelegate4 = this; multicastDelegate4 != multicastDelegate; multicastDelegate4 = multicastDelegate4.prev) { MulticastDelegate multicastDelegate5 = (MulticastDelegate)multicastDelegate4.Clone(); if (multicastDelegate3 != null) { multicastDelegate3.prev = multicastDelegate5; } else { result = multicastDelegate5; } multicastDelegate3 = multicastDelegate5; } for (MulticastDelegate multicastDelegate4 = multicastDelegate2; multicastDelegate4 != null; multicastDelegate4 = multicastDelegate4.prev) { MulticastDelegate multicastDelegate6 = (MulticastDelegate)multicastDelegate4.Clone(); if (multicastDelegate3 != null) { multicastDelegate3.prev = multicastDelegate6; } else { result = multicastDelegate6; } multicastDelegate3 = multicastDelegate6; } if (multicastDelegate3 != null) { multicastDelegate3.prev = null; } return(result); }