
https://refactoring.guru/smells/feature-envy
https://*.com/questions/1242994/effective-c-sharp-tips
Inversion of control <= https://en.wikipedia.org/wiki/Inversion_of_control
<= https://en.wikipedia.org/wiki/Template_method_pattern
如何创建一个对象? 采用多层的办法,可以获得更强的对象 => 1. new class;
2. Create() { ... }
public SimpleSamepleEntity Create() ProxyGenerator generator = new ProxyGenerator(); CallingLogInterceptor interceptor = new CallingLogInterceptor(); SimpleSamepleEntity entity = generator.CreateClassProxy<SimpleSamepleEntity>(interceptor); return entity ; }
ProxyGenerator generator = new ProxyGenerator(); var options = new ProxyGenerationOptions(new InterceptorFilter()) { Selector = new InterceptorSelector() }; SimpleSamepleEntity entity = generator.CreateClassProxy<SimpleSamepleEntity>( options, new SimpleLogInterceptor(), new CallingLogInterceptor()); entity.Name = "Richie"; entity.Age = ;
3. Object factor =>
Template of Define a class ?? => virtual, interface, delegate. 有些工具,像AOP,MOQ 只适用于virtual, interface. 因此,写类时要考虑。
c#-回调callback是什么原理,机制? C# =>
调用者(Caller)向回调函数(Callee)发出调用,被调用函数启动后,不等被调函数执行完毕,程序执行流立即返回到调用者继续执行。此时,程序中至少有两个执行流,一个是调用者执行流;另一个是被调用函数执行流同时执行。当被调函数所执行处理完毕时,被调函数反过来调用一个指定的函数(称为回调函数)向调用者返回处理结果或通知调用者处理结束。这个过程称为回调(Callback)。通常,调用者发出调用时,以函数参数方式将回调函数传递给被调函数。 在C#中,回调过程与其他语言没有区别,只是回调函数是以委托方式传递的。
4. Sort
5. Debug information,
6. Event => standard Event Pattern
7. Testable ? How
8. Readability ?
9. Maintainance ?
END