dispose_template
Table of Contents
Dispose Template
No Native Resources
// TODO: Mark class as IDisposable. #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { // Free managed resources. if (managedResource != null) { managedResource.Dispose(); managedResource = null; } } } #endregion IDisposable Members
Native Resources
// TODO: Mark class as IDisposable. #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } ~Resource() { Dispose(false); } protected virtual void Dispose(bool disposing) { if (disposing) { // Free managed resources. if (managedResource != null) { managedResource.Dispose(); managedResource = null; } } // Free native resources. if (nativeResource != IntPtr.Zero) { Marshal.FreeHGlobal(nativeResource); nativeResource = IntPtr.Zero; } } #endregion IDisposable Members
dispose_template.txt · Last modified: 2017/01/01 20:05 by 127.0.0.1