/// <summary>
/// Sigleton without lock but follow thread safe
/// </summary>
public class SingletonWTLock
{
private static readonly Lazy<SingletonWTLock> _mySingleton = new Lazy<SingletonWTLock>(() => new SingletonWTLock());
private SingletonWTLock() { }
public static SingletonWTLock Instance
{
get
{
return _mySingleton.Value;
}
}
}
/// Sigleton without lock but follow thread safe
/// </summary>
public class SingletonWTLock
{
private static readonly Lazy<SingletonWTLock> _mySingleton = new Lazy<SingletonWTLock>(() => new SingletonWTLock());
private SingletonWTLock() { }
public static SingletonWTLock Instance
{
get
{
return _mySingleton.Value;
}
}
}
No comments:
Post a Comment