Dispose pattern: Difference between revisions

Content deleted Content added
Yobot (talk | contribs)
m WP:CHECKWIKI error #61 fixed + general fixes using AWB (8884)
Umlcat (talk | contribs)
move code example comment different line
Line 12:
Resource resource = null;
try {
resource = getResource(); // Attempt to acquire the resource.
resource = getResource();
// Perform actions with the resource.
...
} finally {
if (resource != null) // Resource might not been acquired, or already freed
if (resource != null)
resource.Dispose();
}