2 ms·
> That "scope that you are exiting ... several layers away" is where you put the try/finally. Yes, I know that it's where you're supposed to put the try/finall
by AnimalMuppet 12y ago
> That "scope that you are exiting ... several layers away" is where you put the try/finally.
Yes, I know that it's where you're supposed to put the try/finally... if you remember. Each time. And if you move the action in the finally clause if the variable changes scope or lifetime.
Destructors are considerably cleaner than this approach. You just put the close in the destructor, and let it do its job.