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