Is it really better not to use finalize compare to dispose ? Does dispose remove unmanaged resource in first parse ?
What is suppressing finalize ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your implementation of IDisposable should be:
If an object has a finalizer the CLR keeps a reference to it in the finalization queue. If you dispose manually the object (calling Dispose()) you already remove the unmanaged resources (as the implementation of dispose and the finalizer is shared), so there is no need to call the finalizer and you can safely remove the object from the finalization queue (calling GC.SuppressFinalize(this)).