Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Dispose Blocks Pattern

Dispose Blocks Pattern

Dispose Blocks Pattern is a feature.

To make the safe use of the dispose pattern less verbose, several languages have some kind of built-in support for resources held and released in the same block of code.

Languages without Dispose Blocks Pattern include Ruby

Languages with Dispose Blocks Pattern include Python, C#

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.
Example from C#:
using (Resource resource = GetResource()) { // Perform actions with the resource. ... }
dependent-types-feature.html 路 dispose-blocks-feature.html 路 duck-typing-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub