garbage collection - In c#,can we use finalize to dispose the managed source? -


according pattern of how use idisposable, microsoft suggests use finalize release unmanaged source. http://msdn.microsoft.com/en-us/library/system.idisposable%28v=vs.80%29.aspx

but happen if write codes release managed source in finalize? when gc call finalize release managed source, happen?

it's bad practice in general. in finalizer code can't rely on state of object , managed resources - can collected or disposed/finalized already. also, can't rely on order, in clr calls finalize.


Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -