Reputation: 75998
I noticed that there is one change about ASP.NET Routing. I cannot understand why such change.
In ASP.NET MVC Preview, the routing setting in Global.ascx is like "[controller]/[action]/[id]". Now, it is changed to be "{controller}/{action}/{id}". Why change [] to {} ? Is there some necessity to do that?
Upvotes: 0
Views: 186
Reputation: 6182
In a route, you define placeholders (referred to as URL parameters) by enclosing them in braces ( { and } ). The / character is interpreted as a delimiter when the URL is parsed.
So now why they changed their code for parsing placeholders from [ ] to { } is something which the developers would know better!!!
Upvotes: -1
Reputation: 59001
Wow, that happened a long while ago. Someday, I hope that the string class itself is augmented with named formats. Then this move will look like a very prescient move. We liked its similarity and consistency with string.format. Also, it is consistent with the UriTemplate format string.
Upvotes: 5
Reputation: 19609
I'm not sure it's the reason why, but it does have the benefit of being much more like String.Format. Convention/less surprise is usually a good thing.
Upvotes: 1