adspace


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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the .net syntax for 'while loop'?

1141