protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (disposed) return; disposed = true; // If this is a call to Dispose, dispose all managed resources. if (disposing) { DoDispose (); } }