0
Differences between static class and singleton class
So basically i understand that both Singleton class and static class can be instantiated once . Is there any other disparity between these 2 concepts?
4 Respostas
+ 1
A static class should be not initated because you can access them without having an Instance of them. On the other hand a Singleton class has a method that only allows to instantiate the class once.
+ 1
@AKC Ya, i agree with you. The only purpose of using static constructor in a static class should be for initializing its static members, i think?
0
@AKC Is it not that the static class contains a static constrcutor that only get instsntisted once by the CLR during the first reference? So can i say that the implementation of Singleton class is a non-static class since it is instantisted using non-static constrcutor?
0
should be fine. But I do not see a purpose for Instantiating a static class, do you, @Alex?