Synopsis: | Avoid implementing a finalizer |
Language: | C# |
Severity Level: | 4 |
Category: | Object lifecycle |
Description: |
If a finalizer is required, adhere to [5@113]. The use of finalizers in C# is demoted since it introduces a severe performance penalty due to way the garbage collector works. Note also that you cannot predict at which time the finalizer is called (in other words, it is non-deterministic). Notice that C# finalizers are not really destructors as in C++. They are just a C# compiler feature to represent CLR Finalizers. |