Yes, it can.But user will not have any control on its invoke.
Yes, we can have static constructor . But user have no control over evoking it.
Yes, It can have..
yes it is possible,
Refer this link
but we can not use this value every time variable is 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
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...
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
reference.And to initialize static member of the class too.
Class2 p = new Class2();
p.a = 45;
static void Main()
2015© C# Corner. All contents are copyright of their authors.
C# Corner. All contents are copyright of their authors.