静态初始化

private static readonly Singleton singleton = new Singleton();

静态初始化模块,在一个类中,用static 修饰的初始化块

应用于对static变量作初始化。

执行:在类第一次被加载时执行初始化,也可以理解类名第一次出现时,一个类只加载一次。

所以他比其他对象变量和初始化模块都执行的早。

原文地址:https://www.cnblogs.com/yinxingyeye/p/2442543.html