using (DbConnection conn = new DbConnection()) { // do stuff with database }
Will the using block call conn.Close()?
using
conn.Close()
Yes, it will; the implementation of DbConnection.Dispose() calls Close() (and so do its derived implementations).
DbConnection.Dispose()
Close()
1.4m articles
1.4m replys
5 comments
57.0k users