Articles → .NET → Difference The Singleton And Static Class In C#

Difference The Singleton And Static Class In C#






Difference


  1. In case of the singleton class, the object can be passed as an object in the function parameter. But static class cannot be passed as an object in the function parameter.
  2. Singleton class can implement interface but static class cannot.
  3. Singleton class supports lazy loading whereas static class does not.
  4. Static class cannot be disposed of.
  5. Singleton class can contain the constructor but you cannot add constructor in the static class.
  6. Singleton class is stored in heap whereas static class is stored in stack.



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, February 25, 2021

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250