基类:
public BaseController()
{
this.ViewData.Add("StartExecuteTime", DateTime.Now);
}
cshtml:
@{
double? dblExecuteTime=null;
object objExecuteStartTime = this.ViewData["StartExecuteTime"];
if(objExecuteStartTime!=null)
{
dblExecuteTime = (DateTime.Now - (DateTime)objExecuteStartTime).TotalSeconds;
}
}
<!--@DateTime.Now.ToString(Constants.yyyy_MM_dd_HH_mm_ss)-->
<!--Cost:@dblExecuteTime-->