摘要: 在对委托使用-=解绑方法时,resharper会出现一个提示:Delegate substraction has unpredictable result。http://confluence.jetbrains.com/display/ReSharper/Delegate+subtraction+has+unpredictable+semantics解释了原因。根据该网页所举出的示例: Action a = () => Console.Write("A"); Action b = () => Console.Write("B"); ... 阅读全文
posted @ 2013-10-03 16:53 瓜王 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 委托的基本使用: class Program { public delegate void CaculateDel(int x, int y); //用delegate 关键字 定义委托类型CacaluteDel public static void Add(int x, int y) //两个方法 { Console.WriteLine(x + y); } public static void Substract(int x, int y) { Consol... 阅读全文
posted @ 2013-10-03 16:18 瓜王 阅读(195) 评论(0) 推荐(0) 编辑