13 lines
313 B
C#
13 lines
313 B
C#
namespace MMOserver.Utils;
|
|
|
|
public abstract class Singleton<T> where T : Singleton<T>, new()
|
|
{
|
|
private static readonly Lazy<T> instance = new Lazy<T>(static () => new T(), LazyThreadSafetyMode.ExecutionAndPublication);
|
|
|
|
public static T Instance => instance.Value;
|
|
|
|
protected Singleton()
|
|
{
|
|
}
|
|
}
|