标签:
以常用的Action委托为例:
public void Function() { //Do something } public void Function2() { //Do something } public void Function3() { //Do something }
public void Execute(Action action) { try { action.Invoke(); } catch (Exception ex) { //Log Debug.WriteLine(ex); } finally { } }
int index = 123;
bool result = false; Execute(() => { result = Function4(index); });
其实也不复杂,理解起来其实就是用Execute(Action action)调用了一个void匿名方法,在匿名方法中执行bool Function4(int index)。值得注意的是:
标签:
原文地址:http://www.cnblogs.com/snys98/p/4259047.html