using is a shorthand statement for IDisposable objects to simplify the try-finally block, with Dispose in the finally block.
http://msdn.microsoft.com/en-us/library/yh598w02.aspx
So yes, you don't have to call Dispose 'manually' in this case.
using System; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { using (var example = new Example()) { //do something } } } class Example : IDisposable { public void Dispose() { //Do something } } }
the Main method will be this in MSIL:
.method private hidebysig static void Main(string[] args) cil managed { .entrypoint .maxstack 2 .locals init ( [0] class ConsoleApplication3.Example example, [1] bool CS$4$0000) L_0000: nop L_0001: newobj instance void ConsoleApplication3.Example::.ctor() L_0006: stloc.0 L_0007: nop L_0008: nop L_0009: leave.s L_001b L_000b: ldloc.0 L_000c: ldnull L_000d: ceq L_000f: stloc.1 L_0010: ldloc.1 L_0011: brtrue.s L_001a L_0013: ldloc.0 L_0014: callvirt instance void [mscorlib]System.IDisposable::Dispose() L_0019: nop L_001a: endfinally L_001b: nop L_001c: ret .try L_0007 to L_000b finally handler L_000b to L_001b }
You can see the try-finally handler and the Dispose call even if you are new to MSIL.
usingblock?IDisposable, you should almost always useusing.