本文介绍了MVC Core IActionResult的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是IActionResult?我尝试查看MSDN和其他站点,但需要通用的,易于理解的常见答案.

What is an IActionResult? I tried looking at MSDN and other sites, but need general, common easy to understand answer.

MSDN IActionResult

示例:

public IActionResult About() {
    ViewData["Message"] = "About Page";
    return View();
}

推荐答案

通俗地说,IActionResult类型是操作结果的基本抽象.它用作代表特定响应类型的其他派生操作结果的基础,其中有很多.

In general terms IActionResult type is a base abstraction of an action result. It is used as the base of other derived action results that represent specific response types, of which there are many.

参考 Asp.Net核心行动结果介绍了

引用官方文档,请在此处找到 ASP.NET Core Web API中的控制器动作返回类型

To quote official documentation Found here Controller action return types in ASP.NET Core Web API

这篇关于MVC Core IActionResult的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 11:46