This is a follow up question to this question:
Finalize/Dispose pattern in C#
So I understand that if I'm creating a class that uses unmanaged resources, I should dispose them. The answer in the linked question says that the finalizer disposes of the unmanaged resources. However, the Dispose(Boolean)
method is also disposing of unmanaged resources:
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// get rid of managed resources
}
// get rid of unmanaged resources
}
So what is the difference between the disposal of the finalizer and the disposal of the dispose method?