浪迹天涯无处为家

所有软件活动包括根本任务——打造构成抽象软件实体的复杂概念结构;次要任务——使用编程语言表达这些抽象实体,在时间和空间内将它们映射成机器语言。
posts - 145, comments - 26, trackbacks - 1, articles - 1

.net 2.0下C#单例模式的精简写法!

Posted on 2006-12-29 15:09 周喜宏 阅读(1620) 评论(0) 编辑 收藏
internal static class Singleton
{
    
public static readonly Singleton instance = new Singleton();
}  

internal 安全性考虑
internal static .net 2.0语言的新特性
static readonly 内存保护,保证线程安全