Programmed Canon Canola calculators in 1977. Assorted platforms and languages ever since. Assisting with HOPL.info.
I am NOT looking for work -- I've got more than enough to do.
Location
Perth, WA Australia
Education
A few diplomas.
Work
Software Engineer at [Daisy Digital](https://daisydigital.com.au/)
It would be interesting to discover whether a Finalizer would work in the same way for a using block as is done in the Benchmark object.
As for the Dispose taking a second parameter, that is mentioned in the Microsoft documentation Implementing a Dispose method which says
The Dispose(Boolean) overload
In the second overload, the disposing parameter is a Boolean that indicates whether the method call comes from a Dispose method (its value is true) or from a finalizer (its value is false).
The Destructor pattern examples I've seen so far don't use this overload. However, the CodeProject article goes into a lot of detail and does discuss the second form thoroughly.
Welcome tag moderator AKA Unofficial DEV cheerleader. While most of my friends are found on SnapChat or Tic-Toc, you can find me here. And I OOP, but I’m not a VSCO girl.
I looked at that CodeProject article as you suggested. It's very detailed and will take me some time to fully digest. The Microsoft doc seems to be a little more precise. I'm just surprised that to use Dispose correctly, you have to keep track it's usage with your own flag. Seems like old school programming. Whenever I use flags in my stuff, our coding advisor always makes a face!
Thanks again for the information. I'll be sure to use it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm intrigued by Erygin's Dispose pattern too. What he is doing is following C#'s Destructor pattern rather than its Finalizer pattern. See Implementing IDisposable and the Dispose Pattern Properly.
It would be interesting to discover whether a Finalizer would work in the same way for a
using
block as is done in theBenchmark
object.As for the Dispose taking a second parameter, that is mentioned in the Microsoft documentation Implementing a Dispose method which says
The Destructor pattern examples I've seen so far don't use this overload. However, the CodeProject article goes into a lot of detail and does discuss the second form thoroughly.
I looked at that CodeProject article as you suggested. It's very detailed and will take me some time to fully digest. The Microsoft doc seems to be a little more precise. I'm just surprised that to use Dispose correctly, you have to keep track it's usage with your own flag. Seems like old school programming. Whenever I use flags in my stuff, our coding advisor always makes a face!
Thanks again for the information. I'll be sure to use it.