public void Dispose() { lock (_semaphore) { OnDispose(); foreach (var @delegate in OnDispose.GetInvocationList()) { OnDispose -= @delegate as Action; } _semaphore.Dispose(); _isDisposed = true; } }