static constructor is called when the execution of the class is started. It is the first member to be execute in the class. at this time how can we pass any parameters to it. if we create object of the class then it will call the non static constructor. so we can not pass any parameters into it at any cost.
As MSDN says, A static constructor is called automatically to initialize the class before the first instance is created. Therefore you can't send it any parameters. If the CLR must call a static constructor how will it know which parameters to pass it?
As MSDN says, A static constructor is called automatically to initialize the class before the first instance is created. Therefore you can't send it any parameters. If the CLR must call a static constructor how will it know which parameters to pass it?
No comments:
Post a Comment