Dispose pattern: Difference between revisions

Content deleted Content added
Umlcat (talk | contribs)
move code example comment different line
Umlcat (talk | contribs)
move code example comment different line
Line 49:
finally
{
if (resource != null) // Resource might not been acquired, or already freed
if (resource != null)
((IDisposable)resource).Dispose();
}
Line 67 ⟶ 68:
} catch(IOException ex){
//handle exception
 
} // The resource x is automatically closed
} // try
</source>