private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { Holder.Remove(hWnd); NativeMethods.DestroyWindow(this.hWnd); UnRegisterWindowClass(); disposedValue = true; } }
private bool disposedValue; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // Managed cleanup this.IconFontFamily.Dispose(); this.Fonts.Dispose(); } // Unmanaged cleanup Holder.Remove(hWnd); NativeMethods.DestroyWindow(this.hWnd); UnRegisterWindowClass(); disposedValue = true; } }