mercredi 1 juin 2016

Dispose pattern usage

I read these articles on Dispose Pattern and Dispose Implementation. My question is when calling the virtual dispose(bool) method from the finalizer, why we only pass false to the method and release unmanaged resource? If we pass true, what will it break?

Also even we have implemented the IDisposble interface, it still relies on the developer to either wrap the code in the using block or to call Dispose() explicitly, in order for the Dispose() method to be invoked. What is the addon of the IDisposble interface, if the developer is not careful enough?

Aucun commentaire:

Enregistrer un commentaire