namespace IFramework.Singleton
{
///
/// 单例属性
///
///
public static class SingletonProperty where T : class, ISingleton
{
private static T _instance;
private static readonly object lockObj = new object();
///
/// 实例
///
public static T instance
{
get
{
lock (lockObj)
if (_instance == null)
{
_instance = SingletonCreator.CreateSingleton();
SingletonCollection.Set(_instance);
}
return _instance;
}
}
///
/// 注销
///
public static void Dispose() { _instance = null; }
}
}