C# 单例使用
public class Singleton
{
#region 单例方法
private static Singleton instance;
private Singleton()
{
}
public static Singleton Instance()
{
if (instance == null)
{
lock (typeof(Singleton))
{
if (instance == null)
{
instance = new Singleton();
}
}
}
return instance;
}
#endregion
}