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
Is string a data type in c#?
Explain the three services model (three-tier application). Presentation (ui), business (logic and underlying code) and data (from storage or other sources).
In gridview in editmode if we want to display information in one combobox based on
what are nullable types in c#
Can we set image Source dynamically using C# in WPF application?
What is an assembly qualified name
What is method in c#?
Write a sample code to write the contents to text file in c#?
Can we overload indexer in c#?
Is c# a strongly-typed language?
What is distribute by in hive?
What is parsing?
What is CLR and its application.?
Which controls do not have events?
Why should I use interface in c#?