Reputation: 67233
The below seem to be very similar:
Upvotes: 1
Views: 480
Reputation: 5900
Both static constructors (see Fourth version) and private constructors can be used to implement the Singleton design pattern.
Upvotes: 1
Reputation: 2340
A static constructor is called the first time the class type is mentioned in any way. Could be used for filling static dictionaries, for example. These constructors can not be called explicitly.
Private constructors on the other hand, can only be called from within the class itself. This can be used to restrict or monitor the creation of new instances of that class, by creating factory methods, for example.
As for the singleton question, Oren A about summed that up.
Upvotes: 0