I'd disagree with Sean's answer; firstly, finalizers should not be routinely added to classes, even if they are IDisposable
- finalizers should only really be used in classes that represent unmanaged resources. Conversely, a class with a finalizer often is also IDisposable
.
Re the question: is Dispose()
called - no, it isn't. The object will be garbage collected at some point in the future (indeterminate), but that is about it. A finalizer wouldn't add much here, as any encapsulated objects will also already be eligible for collection (assuming that they aren't referenced elsewhere).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…