CD.. CD.. - 1 year ago 66
ASP.NET (C#) Question

string.Format with variable names instead of numbers

I've read some posts with some self implementations of this but I think now there should be some method in the ASP.NET MVC that should have this functionality.

I suppose there is some kind of method that can do what string.Format does:

string.Format("example {0}", 1);

but instead of using {0} can work with variables names just like the MVC routes.
for example:

string.Format("example {id}", 1);

Is there such public method in ASP.NET MVC?

Any idea how for example are action links rendered out of routes?]

Answer Source

No as of v2 preview 1, there is no such method in ASP.NET MVC. I don't know of any such method in the .NET Framework, either.