Difference between Singleton and Static Class



Singleton
 Static Class
1
Single means single object across the application
life cycle so it application level
The static does not have any Object pointer, so the scope is at App Domain level.
2
Singleton is a pattern and not a keyword
Static is key word
3
A Singleton can implement interfaces and inherit from other classes and allow inheritance.
Static class allows only static methods 
and you cannot pass static class as parameter.
Static class cannot inherit their instance members
4
Singleton Objects stored on heap memory
Static class stored in stack memory
5
Singleton Objects can have constructor
Static class will have only static constructor ,so overloading it won’t
work
6
Singleton Objects can dispose
We can’t dispose in static class
7
Singleton Objects can clone
We can’t clone in static class

0 Comments

Featured Post

How to Get an Free Azure Subscription for Learning

Whether you're a student, beginner, or professional looking to upskill with Microsoft Azure, here are 3 ways to get started with zero ...

MSDEVBUILD - English Channel

MSDEVBUILD - Tamil Channel

Popular Posts