Snippet: dispose pattern

property value
IDE Visual Studio
Language C#
Title dispose pattern
Shortcut dispose
Description dispose pattern
Snippet Types Expansion
Namespaces System

Code

private bool _disposed;

public void Dispose() {
	Dispose(true);
	GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing) {
	if (!_disposed) {
		if (disposing) {
			throw new NotImplementedException();
		}

		_disposed = true;
	}
}