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())
评论 (0)
暂无评论,快来发表第一条评论吧!