Dispose pattern


Snippet Details

Shortcut
dispose
Description
Code snippet for the dispose pattern
Language
csharp
Types
Expansion
Author
Fons Sonnemans
Upload on
23-11-2016 11:22:39
Downloads
3786

Declarations

ID ToolTip Default
classname Class name ClassNamePlaceholder

Code Output

        ~$classname$() {
            this.Dispose(false);
        }

        public void Dispose() {
            this.Dispose(true);
            GC.SuppressFinalize(this);  // Finalization is now unnecessary
        }

        protected virtual void Dispose(bool disposing) {
            if (disposing) {
                // Free managed resources
            }
            // Free unmanaged resources
        }
      
    

Download Add to .VSIX Package


comments powered by Disqus

Extension Package

No snippets are added


Languages