← back to index

S3880 — Finalizers should not be empty

Language: C#  |  Type: CODE_SMELL  |  Severity: Major

Tags: performance

Why is this an issue?

Finalizers come with a performance cost due to the overhead of tracking the life cycle of objects. An empty one is consequently costly with no benefit or justification.

Noncompliant code example

public class Foo
{
    ~Foo() // Noncompliant
    {
    }
}