What is the use of the static constructor? When static
constructor gets compiled?



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

Post New Answer

More C Sharp Interview Questions

What is the purpose of abstract class in c#?

0 Answers  


Why we use oops in c#?

0 Answers  


What is join in c#?

0 Answers  


Are arrays immutable c#?

0 Answers  


What are the fundamental principles of oo programming?

0 Answers  






What is the difference between <c> and <code> xml documentation tag?

0 Answers  


How does bitwise work?

0 Answers  


what is the difference between the debug class and trace class?

0 Answers   Rolta,


How can we set class to be inherited, but prevent the method from being over-ridden?

0 Answers  


What are the problem with .NET generics?

0 Answers   DELL,


Can abstract class have parameterized constructor?

0 Answers  


What are the types of constructors?

0 Answers  


Categories