3 ms·
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 fil
by sdevlin 15y ago
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"))
{
...
}
- dubajj 15y agoThis 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?)