Implement IDisposable in abstract class
This question already has an answer here:
I would take the implementation provided in this answer:
Proper use of the IDisposable interface
And in derived types override the Dispose(bool disposing)
method if the derived type needs to also dispose of stuff, remembering to call base. If it doesn't need to, then simply do nothing with the base implementation.
Make sure it makes sense to expose the need to call Dispose
on this type's public contract, it could be a sign of a leaked abstraction (though not always).
This would at the very least be a good start.
链接地址: http://www.djcxy.com/p/54480.html上一篇: 什么是在C#中实现IDisposable的正确方法?
下一篇: 在抽象类中实现IDisposable