Hi, all
When we use static constructor ?
Static constructor
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
ranjith60 reputationPosted Jul 5, 2011, 10:39 PM EDT
so, when we are calling static class method if we want to use the values dynamically inside the method then we will go for static constructor.
eg:
public static int somevalue;
class1.CallingStaticMethod(x);
Class1()
{
if(x==10)
somevalue=20;
else
somevalue=30;
}
CallingStaticMethod(int integervalue)
{
int result;
result=somevalue+integervalue;
}
VulpesRank #55 · 29.2K reputationPosted Jul 6, 2011, 3:11 AM EDT