Why to use of the IDisposable interface?

Technology CommunityCategory: .NET CoreWhy to use of the IDisposable interface?
VietMX Staff asked 3 years ago

The “primary” use of the IDisposable interface is to clean up unmanaged resources. Note the purpose of the Dispose pattern is to provide a mechanism to clean up both managed and unmanaged resources and when that occurs depends on how the Dispose method is being called.