使用delegate总是一头雾水,记录一下笔记,备忘. 主要用于线程间操作UI上的控件,以便使用.或者是大家统一操作入口使用. using System.Windows.Forms; namespace System.Delegate { public static class UIDelegate { //------------------ public delegate void myDelegateW(Control str, string s); public delegate str…
stackoverflow上有人问,为什么不能把委托放在一个接口当中? 投票最多的第一个答案第一句话说,“A Delegate is just another type, so you don't gain anything by putting it inside the interface.” 翻译过来大致意思就是:委托只是一种类型,把委托放在接口中你什么也得不到. 看上去挺拗口的,如果你也感觉这句话说的不知所云,那么只能求助于MSDN的接口和委托的定义. 接口:只包含方法.属性.事件或索引…