| 
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 | 
 | 
| 6 | Singleton Objects can dispose | We can’t dispose in static class | 
| 7 | Singleton Objects can clone | We can’t clone in static class | 
tutorials, tips and tricks to design a Windows Phone,Windows Store ,UWP,XAML ,.Net Application , Micrsoft Interview Question
Friday, August 26, 2016
Difference between Singleton and Static Class
Subscribe to:
Post Comments (Atom)
 
 
No comments:
Post a Comment