This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/Backend/Services/BaseService.cs

23 lines
451 B
C#
Raw Normal View History

2019-05-20 00:21:54 +00:00
using System;
namespace Aurora.Backend.Services
{
public abstract class BaseService<T> where T : class
{
private static volatile Lazy<T> _instance = new Lazy<T>(() => CreateInstanceOfT());
public static T Instance
{
get { return _instance.Value; }
}
private static T CreateInstanceOfT()
{
return Activator.CreateInstance(typeof(T), true) as T;
}
}
}