gpt4 book ai didi

c# - Http verbs 属性的 Name 属性是什么?

转载 作者:行者123 更新时间:2023-11-30 17:25:13 25 4
gpt4 key购买 nike

docs对于这个属性,什么都没说,那么这个属性到底有什么作用呢?

最佳答案

引用Routing to controller actions in ASP.NET Core :

Route Name

The following code defines a route name of Products_List:

public class ProductsApiController : Controller
{
[HttpGet("/products/{id}", Name = "Products_List")]
public IActionResult GetProduct(int id) { ... }
}

Route names can be used to generate a URL based on a specific route. Route names have no impact on the URL matching behavior of routing and are only used for URL generation. Route names must be unique application-wide.

引用Generating URLs by route

关于c# - Http verbs 属性的 Name 属性是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59017941/

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