C# 用Singleton类构建多线程单例模式
程序员文章站
2022-06-27 22:30:02
public sealed class Singleton { private static volatile Singleton uniqueInstance; private static readonly object locker = new object(); private Single ......
public sealed class singleton { private static volatile singleton uniqueinstance; private static readonly object locker = new object(); private singleton() { var cache = httpcontext.current.cache; } public static singleton getinstance() { if (uniqueinstance == null) { lock (locker) { if (uniqueinstance == null) { uniqueinstance = new singleton(); } } } return uniqueinstance; } public int number() { return 1; } public int number(int i = 0) { return i; } }
上一篇: 微信,移动互联网大数据开放平台
下一篇: ps制作一张草坪上写字的效果图