您好我已经创建了asp.net Web应用程序而不考虑时区.我直接使用DateTime.Now函数.实际上,它以服务器配置的时区格式返回datetime.现在我无法改变整个应用程序.那么有没有办法将应用程序的TimeZone设置为独立于托管它的服务器?或者有任何方法在Web配置文件中设置.
在BLL课程中,我写道:
Private List<T> GetData(string a, string b)
{
TryAction(()=>{
//Call BLL Method to retrieve the list of BO.
return BLLInstance.GetAllList(a,b);
});
}
Run Code Online (Sandbox Code Playgroud)
在BLL基类中,我有一个方法:
protected void TryAction(Action action)
{
try
{
action();
}
catch(Exception e)
{
// write exception to output (Response.Write(str))
}
}
Run Code Online (Sandbox Code Playgroud)
如何使用TryAction()泛型返回类型的方法?请有个建议.