[阅读: 908] 2008-05-28 17:53:59
public static class Singleton<T>
where T : class, new()
{
private static T instance;
private static object o = new object();
public static T Instance
{
get
{
if (instance == null)
{
lock (o)
{
if (instance == null)
instance = new T();
}
}
return instance;
}
}
}