摘要:
http://sexycoding.javaeye.com/blog/669942 第一种最简单,但没有考虑线程安全,在多线程时可能会出问题,不过俺从没看过出错的现象,表鄙视我……publicclassSingleton{privatestaticSingleton_instance=null;privateSingleton(){}publicstaticSingletonCreateInstance(){if(_instance==null){_instance=newSingleton();}return_instance;}}第二种考虑了线程安全,不过有点烦,但绝对是正规写法,经典的一 阅读全文
posted @ 2011-01-13 10:06
hl3292
阅读(321)
评论(1)
推荐(0)
摘要:
MainApp.wet 下面webconfig,indexWeb.config!--10分钟:首页更新时间间隔-- add key="UpdateTimespan" value="10"/index.asp.UpdateTimespan=% = UpdateTimespan %index.asp.cs.public string UpdateTimespan;UpdateTimespan = System.Configuration.ConfigurationManager.AppSettings["UpdateTimespan"];MainApp.apppublic static 阅读全文
posted @ 2011-01-13 09:31
hl3292
阅读(160)
评论(0)
推荐(0)
摘要:
where 子句用于指定类型约束,这些约束可以作为泛型声明中定义的类型参数的变量。 1.接口约束。 例如,可以声明一个泛型类 MyGenericClass,这样,类型参数 T 就可以实现 IComparableT 接口:public class MyGenericClassT where T:IComparable { } 2.基类约束:指出某个类型必须将指定的类作为基类(或者就是该类本身),才能用作该泛型类型的类型参数。 这样的约束一经使用,就必须出现在该类型参数的所有其他约束之前。class MyClassyT, U where T : class where U : stru 阅读全文
posted @ 2011-01-13 09:30
hl3292
阅读(366)
评论(1)
推荐(0)
浙公网安备 33010602011771号