Some of the properties of Static Constructors are given below. Please add if you know more…

A static constructor does not take access modifiers

A static constructor does not take parameters.

A static constructor is called automatically to initialize the class
before the first instance is created or any static members are
referenced.

A static constructor cannot be called directly.

The user has no control on when the static constructor is executed in the program.

A typical use of static constructors is when the class is using a
log file and the constructor is used to write entries to this file.

Other typical use of static constructor is when the class is using a message box to show the message to the end user.

Developer can directly write classname.method name to access the methods.

Will add some more to complete the static constructors.

Advertisements