What's the point of overriding Dispose(bool disposing) in .NET?

后端 未结 8 1197
故里飘歌
故里飘歌 2021-01-30 10:38

If I write a class in C# that implements IDisposable, why isn\'t is sufficient for me to simply implement

public void Dispose(){ ... } 

to han

8条回答
  •  臣服心动
    2021-01-30 11:07

    In addition to the other great answers, you may want to check these articles:

    • Implementing IDisposable and the Dispose Pattern Properly
    • IDisposable: What Your Mother Never Told You About Resource Deallocation (The Disposable Design Principle)

提交回复
热议问题