public DelayDisposerInfo(IDelayDisposable disposeObject, TimeSpan timeWindow) { Disposed = false; DisposableObject = disposeObject; DisposeWindow = timeWindow; ReceivedDateTime = DateTime.Now; }
static public void Add(IDelayDisposable obj, Int32 msecTimeWindow) { if (obj == null) { return; } Add(obj, new TimeSpan(0, 0, 0, 0, msecTimeWindow)); }
static public void Add(IDelayDisposable obj, TimeSpan timeWindow) { PurgeExpiredObjects(); if (obj == null) { return; } lock (DisposableObjects) { DisposableObjects.Add(new DelayDisposerInfo(obj, timeWindow)); } }
public void Dispose() { lock (this) { if (!Disposed) { Disposed = true; GC.SuppressFinalize(this); if (DisposableObject != null) { DisposableObject.DelayDispose(); DisposableObject = null; } } } }