how to call or access the static constructor in c#.

Posted by Jitendrasoft09 under C# on 3/29/2013 | Points: 10 | Views : 869 | Status : [Member] [MVP] | Replies : 2
If class having only static constructor, how to access the constructor as mentioned below the code-
class employee
{
static employee()
{
console.writeline("This is static constructor");
}
}

Jitendra Kumar
If my post helps you, plz mark as an answer.



Responses

Posted by: Chandan88 on: 4/6/2013 [Member] Starter | Points: 25

Up
0
Down
Hi you cannot access the static constructor. It will get executed before the object creation of the class.

Chandan Singh

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandeepmhatre on: 4/11/2013 [Member] Starter | Points: 25

Up
0
Down
Refer following link:

http://sandeepmhatre.blogspot.com/2013/03/constructors.html


Sandeep M,
Software Developer
Follow me on :
http://sandeepmhatre.blogspot.in

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response