Dispose Blocks Pattern is an actively used design pattern.

?Years Old

Languages with Dispose Blocks Pattern include csharp, python

Example from csharp:

using (Resource resource = GetResource())
{
   // Perform actions with the resource.
   ...
}

Example from python:

with resource_context_manager() as resource:
   # Perform actions with the resource.
# Perform other actions where the resource is guaranteed to be deallocated.

Last updated November 21st, 2019