2016年9月29日

摘要: 1.类定义 public class Company { private string name; private Employee managingDirector; public string Name { get { return this.name; } se... 阅读全文
posted @ 2016-09-29 22:11 听哥哥的话 阅读(2068) 评论(0) 推荐(0) 编辑
摘要: Company c = new Company(); List ps = c.GetType().GetProperties().ToList(); var pname = ps.First(x => x.Name == "Name"); IObjectWrapper owComp = new Obj... 阅读全文
posted @ 2016-09-29 21:43 听哥哥的话 阅读(269) 评论(0) 推荐(0) 编辑
摘要: 1.定义节点 下面两个都定义为键值对 The IoC container Spring Framework (Version 1.3.2) 68 2.应用替换 第二种方法,spring环境变量模式 The IoC container Spring Framework (Version 1.3.2) 70 ... 阅读全文
posted @ 2016-09-29 17:02 听哥哥的话 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 1.xml配置 2.代码 namespace CnblogLesson_4_7 { public class HexuObjectPostProcessor : IObjectPostProcessor { public object PostProcessAfterInitialization(object instance, s... 阅读全文
posted @ 2016-09-29 16:51 听哥哥的话 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 1. 2. public interface IPerson { void pr(); } public class Parent:IPerson { public void Initialize() { Console.WriteLine("init");... 阅读全文
posted @ 2016-09-29 13:44 听哥哥的话 阅读(143) 评论(0) 推荐(0) 编辑
摘要: [C#] public class ExampleObject {public void cleanup(){ // do some destruction work (such as closing any open connection (s))} public void Init() { // do some initialization work } } 这样spring创... 阅读全文
posted @ 2016-09-29 13:13 听哥哥的话 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1.为什么有时候你再执行某个方法的时候比如某个操作 a.权限验证 b.任务执行 当我执行到这个方法的时候,我可以先验证权限,如果验证不通过则替换到另一个方法去执行 public class MyValueCalculator { public virtual string ComputeValue(string input) { // ... some real code } // 2.... 阅读全文
posted @ 2016-09-29 11:53 听哥哥的话 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 1.为什么需要查找方法的注入 当Object依赖另一个生命周期不同的Object,尤其是当singleton依赖一个non-singleton时,常会遇到不少问题,Lookup Method Injection正是对付这些问题而出现的,在上述情况中,setter和构造注入都会导致singleton去维护一个non-singleton bean的单个实例,某些情况下,我们希望让singleton ... 阅读全文
posted @ 2016-09-29 11:44 听哥哥的话 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1.c#代码 TestObject source = new TestObject(); TestEventHandler eventListener1 = new TestEventHandler(); TestEventHandler eventListener2 = new TestEventHandler(); source.Click += eventListener1.Handle... 阅读全文
posted @ 2016-09-29 11:20 听哥哥的话 阅读(182) 评论(0) 推荐(0) 编辑

导航