I am just looking at the using statement, I have always known what it does but until now not tried using it, I have come up with the below code:
using (SqlComma
There may be no advantage to using a using
statement in this case if you're going to have a try
/catch
/finally
block anyway. As you know, the using
statement is syntactic sugar for a try
/finally
that disposes of the IDisposable
object. If you're going to have your own try
/finally
anyway, you can certainly do the Dispose
yourself.
This really mainly boils down to style - your team may be more comfortable with using
statements or using
statements may make the code look cleaner.
But, if the boilerplate the using
statement would be hiding is there anyway, go ahead and handle things yourself if that's your preference.