Singleton Design Pattern vs Static Class in C#

If you are new to design pattern, then read my earlier blog on Design Pattern.
We have explored ASP.Net Singleton Design Pattern in earlier blog.
This blog will help us to know the differences between Singleton Design Pattern and Static Class in C#.

The most common questions asked related to Singleton Design Pattern is difference between static class and Singleton Design Pattern.

 

As you know Singleton Design Pattern allows only one instance through out the application life cycle, and static class does not allow instantiation, by default only one instance created for static class. They looks similar, then what are the differences.

Lets start.
Static Class
Singleton Design Pattern
Cannot create instance of Static class
Can create only one instance of Class.
Static class contain only static members
Singleton does not restrict to static keyword
 
 
 
 
 
 
 
 
 
 
You may read these articles -
Factory Design Pattern
SOLID Principles in C#

Leave a Comment

RSS
YouTube
YouTube
Instagram