Singleton Pattern (Example)
The Singleton design pattern seems generally frowned upon, except for use in logging classes. Below are several variants of the Singleton design pattern, of which, only the thread-safe version merits attention:
- A private constructor
- Static variable for self-tracking
There are three (3) variants
- Thread-safe (Double-checked Locking)
Click the download button for Singleton_CSharp.txt...