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
How do I create a multi language, multi file assembly?
What are annotations in c#?
What is datarelation c#?
What is dataset c#?
What is the difference between console and windows application?
What will a loop recorder show?
What are strings in c#?
What is serialization in .net?
What is a static class in c#?
What is int16?
What are custom exceptions?
Can an int be negative c#?
What is difference between sleep () and wait ()?
Why delegate is used in c#?
What is the real use of interface in c#?