Answer:
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.
Code(example):
class Class2
{
int a;
static Class2()
{
Class2 p = new Class2();
p.a = 45;
System.Console.WriteLine(p.a);
}
static void Main()
{
}
}
Asked In: Many Interviews |
Alert Moderator