public void Dispose()
{
// Check to see if Dispose has already been called.
if (!this.disposed)
{
// Release unmanaged resources. If disposing is false,
// only the following code is executed.
this.disposables.ForEach(x => x.Dispose());
// Note that this is not thread safe.
// Another thread could start disposing the object
// after the managed resources are disposed,
// but before the disposed flag is set to true.
// If thread safety is necessary, it must be
// implemented by the client.
}
this.disposed = true;
// Take yourself off the Finalization queue
// to prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}