日期:2014-05-20 浏览次数:21430 次
using System;
using System.Collections.Generic;
using System.Text;
namespace Pattern.Singleton
{
/**//// <summary>
/// 泛型实现单例模式
/// </summary>
/// <typeparam name="T">需要实现单例的类</typeparam>
public class Singleton<T> where T : new()
{
/**//// <summary>
/// 返回类的实例
/// </summary>
public static T Instance
{
get { return SingletonCreator.instance; }
}
class SingletonCreator
{
internal static readonly T instance = new T();
}
}
}
------解决方案--------------------
用XML也行啊
------解决方案--------------------
没有,全局变量
XML,ini等文件
C/S是一直保持状态的
http://topic.csdn.net/u/20071109/11/fd9aec31-04ef-4cd8-a965-116dec01ecac.html
------解决方案--------------------
http://topic.csdn.net/t/20060724/09/4899772.html
------解决方案--------------------
有全局,静态变量的.