private bool disposedValue = false; // 重複する呼び出しを検出するには protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { OnFinally?.Invoke(this, new EventArgs()); foreach (var d in (OnFinally?.GetInvocationList() ?? Enumerable.Empty <Delegate>()).Cast <EventHandler>()) { OnFinally -= d; } } disposedValue = true; } }
private bool disposedValue = false; // 重複する呼び出しを検出するには protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (Stream != PipelineStream.Empty) { Stream.Dispose(); } OnFinally?.Invoke(this, new EventArgs()); foreach (EventHandler d in (OnFinally?.GetInvocationList() ?? Enumerable.Empty <Delegate>())) { OnFinally -= d; } } disposedValue = true; } }