Tag: 方法重载

c#mvc 3,动作重载?

我一直试图重载我的索引方法。 这是我的索引方法: [ActionName(“Index”)] public ActionResult IndexDefault() { } [ActionName(“Index”)] public ActionResult IndexWithEvent(string eventName) { } [ActionName(“Index”)] public ActionResult IndexWithEventAndLanguage(string eventName, string language) { } 这保持铸造: 控制器类型’CoreController’上的当前操作请求’Index’在以下操作方法之间是不明确的:System.Web.Mvc.ActionResult类型为ManageMvc.Controllers.CoreController的IndexDefault()System.Web.Mvc.ActionResult IndexWithEvent(System。类型为ManageMvc.Controllers.CoreController的类型为ManageMvc.Controllers.CoreController的System.Web.Mvc.ActionResult IndexWithEventAndLanguage(System.String,System.String) 是否不可能使用3种不同的GET方法重载索引操作? 此外,如果可能,那么正确的路线是什么? 我有这个: routes.MapRoute( “IndexRoute”, // Route name “{eventName}/{language}/Core/{action}”, // URL with parameters new { controller = “Core”, action = “Index”, eventName = UrlParameter.Optional, language = UrlParameter.Optional […]