Using nameof() with Url.Action() and async methods in ASP.NET Core 3.x MVC
问题 Let's say I have a ASP.NET Core 3.0 MVC application, which features a simple controller containing two actions and using attribute based routing: [Route("home")] public class HomeController : Controller { public static string ControllerName { get; } = "Home"; public HomeController() { } string GenerateUrls() { string url1 = Url.Action(nameof(Action1), ControllerName); string url2 = Url.Action(nameof(Action2Async), ControllerName); return $"Action1: '{url1}'\nAction2: '{url2}'"; } [HttpGet("a1