The given answer (B) to the below question seems to contradict the IDisposable
documentation which reads:
You should implement IDisposable only if your type uses unmanaged resources directly.
Plus, almost every class I write has managed resources therefore should I be implementing IDisposable
in almost every class?
- If a class has managed resources and no unmanaged resources, it should do which of the following?
a. Implement IDisposable and provide a destructor.
b. Implement IDisposable and not provide a destructor.
c. Not implement IDisposable and provide a destructor.
d. Not implement IDisposable and not provide a destructor.