What's the point of overriding Dispose(bool disposing) in .NET?
问题 If I write a class in C# that implements IDisposable, why isn't is sufficient for me to simply implement public void Dispose(){ ... } to handle freeing any unmanaged resources? Is protected virtual void Dispose(bool disposing){ ... } always necessary, sometimes necessary, or something else altogether? 回答1: It's not strictly necessary. It is part of the recommended Disposable pattern. If you haven't read the Framework Design Guidelines section on this (9.3 in the first edition, don't have the