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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

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

ios - I get the error Property '...' not found on object of type '...' -