0

I've seen many answers showing how to implement Dispose on both Base and Derived (ie like this).

I am however not sure about the case where I'm deriving from Base which implements IDisposed but my Derived have no resources of it's own that need disposing.

In this scenario do I still need to override Dispose at all ?

kofifus
  • 17,260
  • 17
  • 99
  • 173

1 Answers1

2

The simple answer is no you don't need to. It will call the Dispose of the base class, and that all you need.

Ethan.S
  • 385
  • 3
  • 13
  • I assume I still need to do 'using (derived) { ... }` ? – kofifus Aug 22 '21 at 22:45
  • @kofifus You should always properly dispose the object by using the `using` keyword or calling the `Dispose` method when the object is no longer needed. – Ethan.S Aug 23 '21 at 06:58