-4
我知道actionresult是由ViewResult,JsonResult等继承的基类,但我想知道在什么情况下我们可以直接调用ActionResult。我们可以在MVC中使用ActionResult的场景是什么?
我知道actionresult是由ViewResult,JsonResult等继承的基类,但我想知道在什么情况下我们可以直接调用ActionResult。我们可以在MVC中使用ActionResult的场景是什么?
当你需要根据病情来返回结果
public ActionResult TestAction()
{
if(true)
return View();
else
Json(anyObject);
}