![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
爱睡觉的程序员
这个作者很懒,什么都没留下…
展开
-
.net 实现动态代理
1、先新建一个要被代理的类public class User: MarshalByRefObject { public string SayHello() { Console.WriteLine("I am SayHello"); return "I am SuperMan"; } }2、创建类 用于代理类执行方法 /// <summary> /// 动态代理.原创 2021-01-11 13:51:31 · 906 阅读 · 0 评论 -
23种设计模式之原型模式
public abstract class Prototype { private string id; public Prototype(string id) { this.id = id; } public abstract Prototype Clone(); }public class ConcretePrototype : Prototype { ...原创 2020-05-14 17:55:34 · 116 阅读 · 0 评论 -
23设计模式之单例模式
定义:一个类只有一个实例,且该类能自行创建这个实例的一种模式。特点:1、单例类只有一个实例对象 2、该单例对象必须由单例类自行创建。 3、单例类对外提供一个访问该单例的全局访问点。代码实现: 实现方式有好多种 我在这里就写个简单点的 public class Test { private static volatile Test t = null; private Test() { } [...原创 2020-05-14 17:01:15 · 80 阅读 · 0 评论