Finalizers, i.e., destructors, perform clean-up operations as an instance is picked up for garbage collection (GC). If a class has a finalizer defined, it is added to the Finalize
queue, which is later processed by the GC when deemed appropriate. An empty finalizer adds unnecessary additional overhead to the GC since it does not perform effective clean-up operations. Therefore, it is suggested that you either remove the empty finalizer or add relevant clean-up operations.
class CSharpAnalyzer
{
// Empty finalizer
~CSharpAnalyzer()
{
}
}
class CSharpAnalyzer
{
// Non-empty finalizer
~CSharpAnalyzer()
{
// ...
}
}