Should IDisposable be applied cascadingly?

前端 未结 9 1579
灰色年华
灰色年华 2020-12-31 06:48

This is a rather basic question, however I\'m still struggling with it a little.

IDisposable is implemented, when you want to enable the user of an object to free un

9条回答
  •  萌比男神i
    2020-12-31 07:19

    When you provide explicit control using Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from permanently leaking if the programmer fails to call Dispose.

    I think best way to implement this is use combination of Dispose and Finalize method. You can find more Here.

提交回复
热议问题