What is static constructor, when it will be fired? And what is its use?



What is static constructor, when it will be fired? And what is its use?..

Answer / Vinesh Pratap Singh

A static constructor is a special method in C# that initializes the shared data for a class before the first instance of the class is created. It doesn't have an access modifier or return type. The static constructor gets called automatically when the class is loaded into memory by the .NET runtime, not when an object of the class is created. Its primary use is to initialize static variables and perform any initialization that needs to happen before any instance of the class is used.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net General Interview Questions

What is the purpose of enumerable class in .net?

1 Answers  


Using com component in .net?

1 Answers  


What is dot net and its uses?

1 Answers  


Explain weg config settings for exception managment in asp.net?

1 Answers   C Squared Systems,


Why do we use the “using” statement?

1 Answers  


What is IIS and how we deploy website on IIS.

2 Answers   NetLink,


What is a manifest in .net?

1 Answers  


How do you define the lease of the object in .net?

1 Answers  


What are the advantages of .net?

1 Answers  


Define satelite assembly?

1 Answers  


Explain asp.net?

1 Answers  


What is .net and why it is used?

1 Answers  


Categories