What is a singleton in C#?

A singleton is a class which only allows one instance of itself to be created – and gives simple, easy access to said instance. The singleton premise is a pattern across software development.

There is a C# implementation “Implementing the Singleton Pattern in C#” covering most of what you need to know – including some good advice regarding thread safety.

To be honest, It’s very rare that you need to implement a singleton – in my opinion it should be one of those things you should be aware of, even if it’s not used too often.

Leave a Comment