private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { Enumerator.Dispose(); if (RWStream != null) { try { RWStream.Dispose(); } catch (Exception) {} } } disposedValue = true; } }