public void Dispose() { if (_timer != null) { _timer.Cancel(); var localObj = Interlocked.Exchange(ref _timer, null); if (localObj != null) { Marshal.ReleaseComObject(localObj); } } }
public void Dispose() { if (_timer != null) { _timer.Cancel(); var localObj = Interlocked.Exchange(ref _timer, null); if (localObj != null) { Marshal.ReleaseComObject(localObj); } _timer = null; } GC.SuppressFinalize(this); }