在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