add live select pannel

This commit is contained in:
CroakFang
2023-01-20 07:13:54 +08:00
parent 3b18268252
commit a4dc2516e3
1543 changed files with 107369 additions and 9227 deletions
@@ -0,0 +1,33 @@
using System;
using System.Reflection;
namespace DereTore.Common {
public static class SingletonManager<T> where T : class {
static SingletonManager() {
SyncObject = new T[0];
}
public static T Instance {
get {
if (_instance == null) {
lock (SyncObject) {
if (_instance == null) {
var t = typeof(T);
var constructor = t.GetConstructor(BindingFlags.NonPublic | BindingFlags.NonPublic | BindingFlags.Instance, Type.DefaultBinder, new Type[0], null);
if (constructor == null) {
throw new InvalidOperationException();
}
_instance = (T)constructor.Invoke(new object[0]);
}
}
}
return _instance;
}
}
private static T _instance;
private static readonly T[] SyncObject;
}
}