using System;public class Singletonwhere T : class, new(){ private static readonly T s_Instance; static Singleton() { s_Instance = Activator.CreateInstance (); } public static T Instance { get { return s_Instance; } }}
本文共 340 字,大约阅读时间需要 1 分钟。
using System;public class Singletonwhere T : class, new(){ private static readonly T s_Instance; static Singleton() { s_Instance = Activator.CreateInstance (); } public static T Instance { get { return s_Instance; } }}
转载于:https://www.cnblogs.com/zjw007/p/6127362.html