gpt4 book ai didi

返回 void 的 ASP.Net MVC Controller 操作

转载 作者:行者123 更新时间:2023-12-03 05:24:19 25 4
gpt4 key购买 nike

如果我有以下 Controller 操作...

public void DoSomething()
{
}

框架真的会把它转换成这样吗?

public EmptyResult DoSomething()
{
return new EmptyResult();
}

最佳答案

是的

A controller that returns void will produce an EmptyResult.

摘自

The Life And Times of an ASP.NET MVC Controller

关于返回 void 的 ASP.Net MVC Controller 操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2048643/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com