摘要: Table of contents Generics types as a factory Lazy initialization of services Single implementation multiple interfaces Creating instances of types fr 阅读全文
posted @ 2023-04-22 17:47 love/coder 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 兼顾线程安全常用以下三种写法: public sealed class Singleton { private static readonly Singleton instance = new Singleton(); // 显式静态构造器告诉C#编译器 // 不要将类型标记为BeforeField 阅读全文
posted @ 2023-04-22 11:03 love/coder 阅读(21) 评论(0) 推荐(0) 编辑