Dispose pattern usage -
i read these articles on dispose pattern , dispose implementation. question when calling virtual dispose(bool) method finalizer, why pass false method , release unmanaged resource? if pass true, break?
also have implemented idisposble interface, still relies on developer either wrap code in using block or call dispose() explicitly, in order dispose() method invoked. addon of idisposble interface, if developer not careful enough?
from first link:
the boolean parameter disposing indicates whether method invoked idisposable.dispose implementation or finalizer. dispose(bool) implementation should check parameter before accessing other reference objects (e.g., resource field in preceding sample). such objects should accessed when method called idisposable.dispose implementation (when disposing parameter equal true). if method invoked finalizer (disposing false), other objects should not accessed. the reason objects finalized in unpredictable order , they, or of dependencies, might have been finalized.
hope helps.