// Implement the IObjectReference interface. public Object GetRealObject(StreamingContext context) { // Get the first delegate in the chain. Delegate del = entry.ToDelegate(); // Bail out early if this is a unicast delegate. if (!(del is MulticastDelegate) || entry.delegateEntry == null) { return(del); } // Build the multicast delegate chain. Delegate end = del; Delegate newDelegate; DelegateEntry e = entry.delegateEntry; while (e != null) { newDelegate = e.ToDelegate(); if (newDelegate.GetType() != del.GetType()) { throw new SerializationException (_("Arg_DelegateMismatch")); } ((MulticastDelegate)end).prev = (newDelegate as MulticastDelegate); end = newDelegate; e = e.delegateEntry; } return(del); }