//传入一个委托值.(函数地址吧!)private void CallMethod<T>(Func<T, int> func, T item)
{
try
{
func(item);
}
catch (Exception e)
{
Log(e);
}
finally
{
DoOther();
}
}
private void button1_Click(object sender, EventArgs e)
{
CallMethod(new Func<string, int>(MethodTest), "Hello");
}
private int MethodTest(string str)
{
//Do();
MessageBox.Show(str);
return 0;
}