Why does a static constructor not have any parameters?

前端 未结 9 1536
忘掉有多难
忘掉有多难 2021-02-07 03:02

Per MSDN:

A static constructor does not take access modifiers or have parameters.

A static constructor is called automatically to ini

9条回答
  •  日久生厌
    2021-02-07 03:17

    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?

提交回复
热议问题