Singleton Design Pattern In C# – Part 2 (Eager and Lazy Initialization in Singleton)


In the previous article on learning singleton pattern, we discussed what is singleton design pattern, when is it needed and what problems it solves. We also discussed how to create a basic singleton class step by step and how to enhance that class to be thread-safe with the help of locking and performance effective with the help of double check locking. In this article, we’ll discuss Lazy initialization, the lazy keyword, why to make singleton class a sealed class, and what are the differences between singleton and static class. Before we start, I strongly recommend you go through my last article.

Continue reading “Singleton Design Pattern In C# – Part 2 (Eager and Lazy Initialization in Singleton)”


Singleton Design Pattern in C# – Part 1


I always wanted to write on Singleton design pattern in C#. Though there already are many posts available on Singleton design pattern, I’ll try to cover this topic in the most simplistic and easy to understand way.

Continue reading “Singleton Design Pattern in C# – Part 1”