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 |
How can you sort the elements of the array in descending order?
Why do we use overloading in c#?
How many parameters can a method have c#?
What is the difference between list and dictionary in c#?
In which way a two-dimensional array declared in C#?
What is a method signature c#?
What is void method?
Please explain value types and reference types used in c#?
Is list ienumerable c#?
What does the dispose method do with the connection object?
What are class fields?
Write code for palindrome?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)