静态初始化

private static readonly Singleton singleton = new Singleton();

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

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

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

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

posted @ 2012-04-11 16:13  银杏叶儿  Views(197)  Comments(0Edit  收藏  举报