Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
sdevlin
· 14y ago · 0 comments
C#'s 'using' statements allow this kind of pattern for types implementing IDisposable. It looks something like this (might be a little off):
using (var file = File.Open("foo.txt")) { ... }
Comments
[–]
dubajj
14y ago
This is what I thought of immediately except to implement the end with behavior you have to override the IDisposable shut down sequence? (does that make sense?)