Timeline for How do Singletons differ from Static variables?
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 26, 2022 at 21:51 | comment | added | Alexei Levenkov | @gnasher729 can you please clarify "This code is broken" part of your comment? Indeed it is a fact that finalizer of an object (if one exist) may or may not be called on exist, but I don't see it related to "it is broken" statement. There are no destructors in C#... (which seem to be the choice of language here as OP asked about .Net). | |
Mar 26, 2022 at 18:34 | comment | added | gnasher729 | This code is broken. The destructor for the static variable will be called at an unpredictable time when the program exits. | |
Mar 25, 2022 at 16:24 | comment | added | tofro | Agree in principle (+1) but there are some nice features beyond syntatic sugar. A useful one is: you can identify instances that potentially access singletons with a simple breakpoint in the debugger. Their main downsides seem to be that they are way overused ;) | |
Mar 25, 2022 at 13:47 | history | answered | Philip Kendall | CC BY-SA 4.0 |