ChangeMonitor.Dispose Method (Boolean)
Releases all managed and unmanaged resources and any references to the ChangeMonitor instance. This overload must be implemented by derived change-monitor classes.
Assembly: System.Runtime.Caching (in System.Runtime.Caching.dll)
true to release managed and unmanaged resources and any references to a ChangeMonitor instance; false to release only unmanaged resources. When false is passed, the method is called by a finalizer thread and any external managed references are likely no longer valid because they have already been garbage collected.
When the value of disposing value is true, all managed and unmanaged resources are disposed and any references to this object are released so that the derived change-monitor instance can be garbage collected. It is guaranteed that the base Dispose method will invoke the implemented method only one time.
Notes to Implementers:
Alternatively, a change monitor can implement a finalizer method. In that case, the finalizer can invoke the OnChanged method disposes the change-monitor instance (unless initialization has not finished).method and pass it a disposing value of false. However, this is usually unnecessary. Monitoring for dependency changes is typically performed by a service that maintains a reference to the change-monitor instance. The reference prevents the instance from being garbage collected, and therefore makes a finalizer method unnecessary. To avoid memory leaks, when a dependency changes, the
Available since 4.0