public WeakMulticastDelegate CombineUnique(Delegate realDelegate) { bool found = Equals(realDelegate); if (!found && prev != null) { WeakMulticastDelegate curNode = prev; while (!found && curNode != null) { if (curNode.Equals(realDelegate)) { found = true; } curNode = curNode.prev; } } return(found ? this : this.Combine(realDelegate)); }
public WeakMulticastDelegate Remove(Delegate realDelegate) { if (Equals(realDelegate)) { return(this.prev); } WeakMulticastDelegate current = this.prev; WeakMulticastDelegate last = this; while (current != null) { if (current.Equals(realDelegate)) { last.prev = current.prev; current.prev = null; break; } last = current; current = current.prev; } return(this); }