上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页
摘要: 装饰者模式: 例子:对StringBuilder进行装饰 public class MyString { private StringBuilder sb = new StringBuilder(); public static implicit operator MyString(string s 阅读全文
posted @ 2022-05-17 13:57 后跳 阅读(21) 评论(0) 推荐(0)
摘要: 例子:对应 https://www.cnblogs.com/Zingu/p/16256988.html enum Color { Yellow, Red, Green } enum Size { Small, Medium, Large, Yuge } class Product { public 阅读全文
posted @ 2022-05-14 17:29 后跳 阅读(29) 评论(0) 推荐(0)
摘要: 复合模式 神经元和神经元组 public static class ExtensitionNeural { //public static void ShowNeuralsIn(this Neural l, int dent) //{ // Console.WriteLine($"{new stri 阅读全文
posted @ 2022-05-14 16:06 后跳 阅读(75) 评论(0) 推荐(0)
摘要: class GraphicObject { public virtual string GroupName { get; set; }= "Group"; public string Color; private Lazy<List<GraphicObject>> graphicObjects = 阅读全文
posted @ 2022-05-14 13:08 后跳 阅读(65) 评论(0) 推荐(0)
摘要: 桥: interface IRenderer { void RenderCircle(float radius); } class VectorRenderder : IRenderer { public void RenderCircle(float radius) { Console.Write 阅读全文
posted @ 2022-05-13 17:44 后跳 阅读(32) 评论(0) 推荐(0)
摘要: 适配器模式+AutoFac interface ICommand { void Excute(); } class OpenCommand : ICommand { public void Excute() { Console.Write("this is Opened"); } } class S 阅读全文
posted @ 2022-05-13 16:16 后跳 阅读(42) 评论(0) 推荐(0)
摘要: 适配器模式: 我国规定民用交流电压是220V(+10% -15%),就是说交流220V电压正常范围在187V--242V 但是每种电器的接收的电压都不一致: 1.电脑 2手机 3.空调 虽然输入电压是相同的220V 但是电器内部少有能直接接收220V电压的零件。 再举个例子。或者说你的手机出国也能充 阅读全文
posted @ 2022-05-13 10:38 后跳 阅读(538) 评论(0) 推荐(0)
摘要: 单例模式 线程检查: public sealed class PreThreadSingleton { private static ThreadLocal<PreThreadSingleton> local = new ThreadLocal<PreThreadSingleton>(() => n 阅读全文
posted @ 2022-05-12 17:44 后跳 阅读(35) 评论(0) 推荐(0)
摘要: 单例模式 LAZY<T>: interface IDatabase { int GetConnection(string name); } class FileDatabase : IDatabase { private Dictionary<string, int> dic = new Dicti 阅读全文
posted @ 2022-05-12 17:40 后跳 阅读(71) 评论(0) 推荐(0)
摘要: 单例模式 MonoState public class Boss { private static string name; public string Name { get => name; set => name = value; } public override string ToStrin 阅读全文
posted @ 2022-05-12 17:35 后跳 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页