/// <summary> Initializes a new instance of the <see cref="EventContainer"/> class. /// </summary> /// <param name="eventHandle">The weak event handle.</param> /// <param name="keepAlive">if set to <c>true</c> the <see cref="EventHandle"/> is kept alive.</param> public EventContainer(EventHandle eventHandle, bool keepAlive) { if (keepAlive) { _eventHandle = eventHandle; } else { _weakEventHandleWeakRef = new WeakReference(eventHandle); } KeepAlive = keepAlive; }
/// <summary> Disposes this container. /// </summary> /// <remarks>Does not dispose the stored <see cref="EventHandle"/>. Only the reference to it is removed.</remarks> public void Dispose() { _eventHandle = null; _weakEventHandleWeakRef = null; }