Proper use of the IDisposable interface

后端 未结 19 3330
情深已故
情深已故 2020-11-21 04:05

I know from reading the Microsoft documentation that the \"primary\" use of the IDisposable interface is to clean up unmanaged resources.

To me, \"unman

19条回答
  •  太阳男子
    2020-11-21 04:57

    If anything, I'd expect the code to be less efficient than when leaving it out.

    Calling the Clear() methods are unnecessary, and the GC probably wouldn't do that if the Dispose didn't do it...

提交回复
热议问题