MVC路由系统

时间:2014-05-18 11:49:19

标签: c#

例如,在调用方法时,运算符:是什么意思?我看到它在方法中映射了参数名称。什么意味着name : "Default"如何解释它?这种调用方法的名称是什么?

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

1 个答案:

答案 0 :(得分:1)

这被称为“命名参数”,我不会称之为运算符。 (虽然有一个?:运算符)

Named and Optional Arguments (C# Programming Guide)