Why change [] as {} in ASP.NET routing?

I noticed that there is one change in ASP.NET routing. I can't figure out why there is such a change.

In ASP.NET MVC Preview, the routing parameter in Global.ascx is like "[controller] / [action] / [id]". It has now been changed to "{controller} / {action} / {id}". Why change [] to {}? Is there a need for this?

0


source to share


3 answers


I'm not sure if this is the reason, but it has the advantage of being more like String.Format. Convention / less surprise is usually a good thing.



+1


source


Wow, this happened a long time ago. Someday I hope that the string class itself is augmented by named formats. Then this move will look very predictable. We liked its similarity and consistency with string.format. Also, it is consistent with the UriTemplate format string.



+5


source


In a route, you define placeholders (called URL parameters) by enclosing them in curly braces ({and}). The / is interpreted as a delimiter when parsing a URL.

So why they changed their code to parse placeholders from [] to {} is something that developers will know better !!!

-1


source







All Articles