// Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { fsw.EnableRaisingEvents = false; } fc.Dispose(); fsw.Dispose(); --instanceCount; System.Diagnostics.Debug.WriteLine("~FileWatcher - Remaining instances: " + instanceCount); disposed = true; base.Dispose(); }