What is the use of the static constructor? When static
constructor gets compiled?
Answer Posted / jitendra
Static constructor is used to initzialise the static data
members when the class has been instantiated first time.
Static data members can certainly be initialized at the
time of their declaration but there are times when value of
one static member may depend upon the value of another
static member. In such cases we definitely need some
mechanism to handle conditional initialization of static
members. To handle such situation, C# provides static
constructor.
| Is This Answer Correct ? | 20 Yes | 2 No |
Post New Answer View All Answers
What is delegate in c# interview questions?
If a class derives from another class, will the derived class automatically contain all the public, protected, and internal members of the base class?
Does google use c#?
How do you escape a character?
What are the Features in .net framework 1.1
What is console application with example?
What is the difference between inheritance and abstract class?
What is the namespcae generally given to the webpage of the .NET Framework ?
What's the difference between the debug class and trace class? Documentation looks the same.
what is IComparable
Is python easier than c#?
Explain About .Net remoting
Is datetime nullable c#?
What is code verification?
When a switch is said to be congested?