1.具体说明:看第 二点 2.
2.以下代码2两个类一个winfrom窗体 具体说明看代码注释
3.没引用其他外部类和方法 copy(看具体需求)直接用
第一个类:
public abstract class SingletonModel<T> where T : class
{
private static T sInstance;
/// <summary>
/// 创建获取实例
/// </summary>
/// <returns></returns>
public static T Instance()
{
lock (typeof(T))//在初始化之前lock住这个变量
{
if (sInstance == null)
{
sInstance = Activator.CreateInstance(