Tuesday, February 5, 2019

c# - Destructor vs IDisposable?

I've read about disposing objects/IDisposable interface and destructors in C#, but to me they seem to do the same thing?



What is the difference between the two? Why would I use one over the other? In fact, in this example (link below) this code uses both the IDisposable interface and a destructor:



http://msdn.microsoft.com/en-us/library/system.idisposable.aspx



The comment says the destructor is if the finalization code is not used, but how do I decide when to use one over the other?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...