Can a non static class have static constructor?
Posted by Shambhu in C# Programming on Dec 16, 2012
  • 0
  • 8
  • 10110
Do you know the answer for this question? Post it below.
Posted by Ashish on Apr 24, 2014
  • 0

Yes, it can.But user will not have any control on its invoke.

Posted by Ashish on Apr 22, 2014
  • 0

Yes, we can have static constructor . But user have no control over evoking it.

Posted by Ravikumar G on May 14, 2013
  • 0

Yes, It can have..

Posted by Sandeep Mhatre on Apr 23, 2013
  • 0

yes it is possible,

Refer this link

Posted by Tanuj Khurana on Feb 25, 2013
  • 0

but we can not use this value every time variable is 0

Posted by jeevan prasad on Feb 12, 2013
  • 0

yes we can create the static constructor in non static class...
it is parameter less and how static constructor called only once when how many number of objects created to the that class
static fields only one reference

Posted by Dinesh Bhoje on Jan 17, 2013
  • 0

Yes Normal class can have static constructor but only one.

it automatically called only once when any of class member is first time called or access.. even at instance creation.

And important thing is static constructor should be parameterless...

Posted by Shambhu on Dec 16, 2012
  • 0

Yes, it is possible.

But we have to create an object of the class inside the static
constructor and then initialize the non static member through the object

And to initialize static member of the class too.

class Class2


int a;

static Class2()


Class2 p = new Class2();

p.a = 45;



static void Main()