public static string UrlName(this Type controller)
{
  var name = controller.Name;
  return name.EndsWith("Controller") ? name.Substring(0, name.Length - 10) : name;
}

  Then you can use:

Url.Action(nameof(ActionName), typeof(HomeController).UrlName())

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2021-09-05
  • 2021-11-26
  • 2021-10-05
  • 2021-08-08
  • 2022-12-23
相关资源
相似解决方案