在BLL类,我已经写了:如何使用System.Action和返回类型?
Private List<T> GetData(string a, string b)
{
TryAction(()=>{
//Call BLL Method to retrieve the list of BO.
return BLLInstance.GetAllList(a,b);
});
}
在BLL基类,我有一个方法:
protected void TryAction(Action action)
{
try
{
action();
}
catch(Exception e)
{
// write exception to output (Response.Write(str))
}
}
如何使用TryAction()
方法与一般的返回类型? 请有一个建议。
感谢帮助了很多。 – Pravin 2012-02-24 05:45:00