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 |
What is window application in c#?
Explain the difference between Metadata and Manifest
what are the contents of an assembly ?
How do I register my code for use by classic com clients?
Why c# is type safe?
From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
Explain About a class access specifiers and method access specifiers.
What Is The Difference Between ViewState and SessionState?
Why ienumerable is used in c#?
What is dynamic object in c#?
Which class comes after the SortedList class?
What is a multicast c# delegate?