That should be a perfectly usable Singleton, if you just stay on one thread? Is the application using multiple threads? Should it be?
Most UI applications sooner or later need at least some basic background processing but if I was writing a simple password manager, I'd most likely just do everything blocking on the UI thread.
That said: for simple patterns like singleton, there is really no reason not to use the builtin and recommended way which is the Lazy<T>.
Most UI applications sooner or later need at least some basic background processing but if I was writing a simple password manager, I'd most likely just do everything blocking on the UI thread.
That said: for simple patterns like singleton, there is really no reason not to use the builtin and recommended way which is the Lazy<T>.