Home Syntax for asp.net mvc routing
Reply: 1

Syntax for asp.net mvc routing

amod
1#
amod Published in 2018-01-12 16:18:01Z
routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

How is the above syntax possible? i.e name : "Default" and why can't we use it for normal custom method calls

Daniel A. White
2#
Daniel A. White Reply to 2018-01-12 16:19:41Z

Those are just the argument names. C# allows you to positionaly place arguments with specifying their names. This makes it readable.

For instance this is completely valid:

void Foo(string arg) { ... }

Foo(arg: "bar");
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.409273 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO