EDIT: This question is a duplicate of What is the difference between managed and native resources when disposing? (.NET) and many others. Please answer the others if you have something to add.
According to the Framework Design Guidelines by Krzysztof Cwalina and Brad Abrams, a type that contains instances of disposable types should implement IDisposable.
Is there any other general rule of thumb for when it is best practice to implement IDisposable?
Implement IDisposable when you have a class what wraps an unmanaged resource or when your class has a field that implements IDisposable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With