InterviewSolution
| 1. |
Can A Class Have Static Constructor? |
|
Answer» Yes, a class can have static constructor. Static constructors are called automatically, immediately before any static fields are ACCESSED, and are generally used to initialize static class members. It is called automatically before the first instance is created or any static members are REFERENCED. Static constructors are called before instance constructors. An example is shown below. using System; Yes, a class can have static constructor. Static constructors are called automatically, immediately before any static fields are accessed, and are generally used to initialize static class members. It is called automatically before the first instance is created or any static members are referenced. Static constructors are called before instance constructors. An example is shown below. using System; |
|