What is the use of the static constructor? When static
constructor gets compiled?
Answer / 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 |
Why is it a bad idea to throw your own exceptions?
How do I do a case-insensitive string comparison?
What is a jagged array?
What does exclamation mark mean c#?
What you mean by inner exception in c#?
Ho we can see assembly information?
What does assert() do?
What is strongly typed in c#?
what is main function of alternate teamplate of datalist?
What are the access-specifiers available in c#?
Why is c# better than java?
What is use of list in c#?