When seeing about the whole finalizer/IDisposable issue, it is usual to see that, at the end, after all the long description, there will be something to the meaning of “LOL what I said was actually useless, you should use SafeHandle instead bye!”
So I am wondering in what case does SafeHandle not fit, such that you have to resort to the finalizer/IDisposable old way?
When seeing about the whole finalizer/IDisposable issue, it is usual to see that, at
Share
Clearly, when the unmanaged resource you are wrapping is not acquired through a handle. Which is rare but not unheard of. An example would be writing wrappers in C++/CLI code, commonly done to wrap a native C++ class. The resource is then memory. The unmanaged kind.
Nevertheless, you can spend a career writing managed code and never write a finalizer. Finalizers belong in the framework classes.