Files
a301_mmo_game_server/MMOTestServer/MMOserver/Utils/Singleton.cs

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()
{
}
}