【.NET】单例模式标准写法

public sealed class Singleton
{
private static Singleton instance = null;
static readonly object padlock = new object();

Singleton()
{
}

public static Singleton Instance
{
get
{
if (instance == null)
{
lock (padlock)
{
if (instance == null)
{
instance = new Singleton();
}
}
}
return instance;
}
}
}

上一篇:OAuth的MVC实现(微软)


下一篇:Windows Programming ---- Beginning Visual C#