General Rule for When to Implement IDisposable

后端 未结 6 1435
南旧
南旧 2020-11-29 12:00

EDIT: This question is a duplicate of What is the difference between managed and native resources when disposing? (.NET) and many others. Please answer the

6条回答
  •  长情又很酷
    2020-11-29 12:13

    I normally implement IDisposable every time I need to do a clean up of items. For me this is when writing code that abstracts database/network/filesystems.

    It just marks items ready for the Garbage Collector instead of waiting for it to try do it on its own.

提交回复
热议问题