What's the purpose of implementing the IDisposable interface?

后端 未结 5 979
无人及你
无人及你 2021-01-13 13:05

What\'s the purpose of implementing the IDisposable interface? I\'ve seen some classes implementing it and I don\'t understand why.

5条回答
  •  伪装坚强ぢ
    2021-01-13 13:34

    It all has to do with the garbage collection mechanism. Chris Sells describes garbage collection, finalizers, and the reason for the Dispose pattern (and the IDisposable interface) episode 10 of .NET Rocks! (starting about 34 minutes in).

提交回复
热议问题