Click or drag to resize
DbConnectionExtensionMethodsSafeClose Method
A safe close routine for a database connection, which can also dispose the connection, if required.

Namespace: SD.Tools.BCLExtensions.DataRelated
Assembly: SD.Tools.BCLExtensions (in SD.Tools.BCLExtensions.dll) Version: 1.0.0.0 (1.0.10.1127)
Syntax
public static void SafeClose(
	this DbConnection toClose,
	bool dispose
)

Parameters

toClose
Type: System.Data.CommonDbConnection
the connection to close
dispose
Type: SystemBoolean
if set to true, it will also dispose the connection.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DbConnection. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also