I try to avoid using static classes in my production code because they cannot be introduced, there is no control over the default initialization, and finally you cannot really clear your resources implicitly, since there is no destructor for static objects. Also, you cannot implement IDisposable for a static class, so sounds like static classes are never good for wrapping around unmanaged resources ... It is clear that singletones are the best solution to replace using static classes directly in in this case. But my question is: why does the compiler not support static destruction, because what difference does GC make to track references to a static object and an instance?
source share