Why does a static constructor not have any parameters?

前端 未结 9 1532
忘掉有多难
忘掉有多难 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:23

    Static Constructor

    Because static constructor invoke automatically (we does not have any control over calling of static constructor) that's why we can't pass parameter to static constructor.

    And if we can not pass parameter to static constructor, then why we will create static constructor as parameterized.

    So, we must have parameter less static constructor.

提交回复
热议问题