Possible Duplicate:
Named string formatting in C#
Has anyone found a way to use named identifiers in the String.Format command? Having that kind of functionality would be helpful for "old" folks like us with failing memories. I mean since the braces are a reserved character in this command anyway, does the text within it really matter?
Does MVC follow roughly the same syntax when defining a route?
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
So instead of using:
String.Format("http://foobar.com/calendar/{0}/{1}", selectedYear, selectedMonth);
Wouldn't it follow to see:
String.Format("http://foobar.com/calendar/{year}/{month}", selectedYear, selectedMonth);
Or even:
String.Format("http://foobar.com/calendar/{year}/{month}", new {selectedYear, selectedMonth});
The second statement doesn't compile obviously but I was wondering if someone had found a way to implement that functionality.