private bool disposedValue = false; // To detect redundant calls /// <summary> /// Override this to dispose things in your child class /// </summary> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { GcHandle.Free(); } disposedValue = true; } }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { window.Close(); EventCallback = null; swapchain.Framebuffer.Dispose(); swapchain.Dispose(); GcHandle.Free(); } disposed = true; } }