This is a destructor , not a constructor. They are commonly used to release their own resources or descriptors in classes that wrap their own APIs.
Saying adding a constructor that calls GC.Collect() is a bad idea. The destructor is called only during finalization, so the garbage collector already clears this object and any object referenced by this object. There is no reason for this, since it simply adds extra overhead and actually slows down the system.
This was probably written by someone with a C ++ background that did not understand the intricacies of memory management in .NET. I would recommend deleting this at all.
source share