.net event 使用 Action

来源:互联网 发布:linux 文件夹映射 编辑:程序博客网 时间:2024/05/17 09:02
Action<string> methodCall = (x) => { x += "haha"; MessageBox.Show(x); };        public event Action<string> BoilerEventLog;        private void button2_Click(object sender, EventArgs e)        {            BoilerEventLog += new Action<string>(methodCall);            BoilerEventLog("123");        }

其实很好理解,Func和Action还有Predicate本质就是委托。

Func和Action大同小异,就不赘述了。