public class MyClass
{
private MyClass() { }
//保证线程安全的延时加载单例
public static MyClass Instance
{
get { return Nested._Instance; }
}
private class Nested
{
static Nested() { }
internal static readonly MyClass _Instance = new MyClass();
}
}
最近看到一种单例模式的实现,但实在不理解为何是线程安全的,请各位大牛们赐教
互换的青春
慕村225694