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 |
What is float in unity?
difference between managed code and unmanaged code ?
If you define integer variable and a object variable and a structure then how those will be plotted in memory ?
What is parallel foreach in c#?
Which one is trusted and which one is untrusted?
What is Implicit conversion in C#?
Can we throw exception from catch block
What is equal c#?
What exactly is serverless?
Can you prevent your class from being inherited and becoming a base class for some other classes?
I want to print "Hello" even before main() is executed. How will you achieve that?
Why do we use Design Pattern?
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)