Singleton is a design pattern which restricts instantiation of a class to a single object which means you can create one and only one object of a Singleton class. There could be multiple ways to create Singleton class, you may refer a very good article on different ways of creating Singleton class.
In C#, static class is a class which has all members (data members, constructor, methods etc.) as static. Static class is implicitly sealed so it can’t be inherited.
Key differences between Singleton class and static class
- Singleton class can implement interface and it can also extend class whereas static class can’t (As static class is implicitly sealed class).
- Singleton class can have one and only one object instantiate whereas you can’t create any instance of static class.
- Singleton can have non-static members whereas static class has all its members static.
- Singleton can use polymorphism whereas static class can’t.
- Purpose of static class is to provide utility methods and shared data whereas Singleton serves different purpose.
Note: Here all the definitions and differences are for C# language.