【Unity】通用单例类 Singleton
内容
代码
public class Singleton<T> where T : new() {
private static T _instance;
public static T Instance {
get {
if (_instance == null) {
_instance = new T();
}
return _instance;
}
}
}
本文来自博客园,作者:星空探险家,转载请注明原文链接:https://www.cnblogs.com/PuppetLazy/p/18017775