Skip to main content
 首页 » 编程设计

c#之使用静态构造函数初始化类

2024年02月23日18shanyou

在什么情况下我应该使用静态构造函数来初始化一个类?

请您参考如下方法:

来自 here :

A static constructor is used to initialize any static data, or to perform a particular action that needs performed once only. It is called automatically before the first instance is created or any static members are referenced.