Since .NET has a garbage collector why do we need finalizers/destructors/dispose-pattern?

前端 未结 12 1639
粉色の甜心
粉色の甜心 2020-12-07 09:09

If I understand correctly the .net runtime will always clean up after me. So if I create new objects and I stop referencing them in my code, the runtime will clean up those

12条回答
  •  南笙
    南笙 (楼主)
    2020-12-07 09:47

    Some objects might need to clean up low-level items. Such as hardware that needs to be closed, etc.

提交回复
热议问题