There are a number of easy ways to work out the answer to this for any given object without consulting the documentation:
- If you wrap it in a
using
block and it's notIDisposable
, you'll get a syntax error. - If your class has a
.Dispose
method (easily checked in Intellisense) then you should wrap it. - If your class implements
IDisposable
(easily checked through "go to definition" or the new "peek" functionality in VS) you should wrap it.
Alternatively, by way of example, you can see from the MSDN docs that IDbCommand
implements IDisposable
and therefore should be disposed of with a using
block.