Singleton Design Pattern vs Static Class in C#

If you are not aware about Singleton Design Pattern, please read my earlier blog here -

ASP.Net Singleton Design Pattern


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










Comments

Popular posts from this blog

CAML Query in SharePoint 2010

Calling REST APi from server side code - C#

All about SharePoint 2010 Content Type Hub

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX