public GarbageRegistrationKey(EventListenerBase listener, IGarbageSink sink) { Listener = listener; Sink = sink; }
/// <summary> /// Registers a garbage sink with the listener without activating. /// </summary> /// <param name="sink">the sink to register</param> /// <returns>A registration key for the sink</returns> /// <remarks>Sinks will not begin to recieve garbage notification /// until <em>after</em> the registration key's <em>Activate</em> /// method is called.</remarks> public ISinkRegistrationKey RegisterGarbageSink(IGarbageSink sink) { if (sink == null) throw new ArgumentNullException("sink"); GarbageRegistrationKey key = new GarbageRegistrationKey(this, sink); Util.LazyInitializeWithLock(ref _garbageNotifier, _notifierLock) .AddRegistration(key); return key; }