.net event 使用 Action

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大同小异,就不赘述了。

posted @ 2017-07-05 11:46  正怒月神  阅读(821)  评论(0编辑  收藏  举报