C#常用技巧.

1.Singleton的实现.
将类的构造器设为私有;然后定义一个类的静态/只读字段(本类)即可.
public class test
{
   public   test readonly static Ins = new test();
   private test(){}
}
posted @ 2007-11-09 22:28  23热爱,自学业余码农。  阅读(138)  评论(0)    收藏  举报