using (MyResource myRes = new MyResource())
{
myRes.DoSomething();
}
==
MyResource myRes= new MyResource();
try
{
myRes.DoSomething();
}
finally
{
// Check for a null resource.
if (myRes!= null)
// Call the object's Dispose method.
((IDisposable)myRes).Dispose();
}
this.System.IDisposable.Dispose()
((IDisposable)this).Dispose();