Using .NET string formatting you can plug the same value into a format string multiple times:
Console.Write("{0}{0}{0}", 1) //prints "111"
Is there any way to do this with printf-style formatting, supplying the value only once?
Using .NET string formatting you can plug the same value into a format string multiple times:
Console.Write("{0}{0}{0}", 1) //prints "111"
Is there any way to do this with printf-style formatting, supplying the value only once?
No. The values are taken in order, from the stack, when passed to the function. If you want multiple appearances of the same value if different parts of the string, you have to supply them in order, multiple times.
Think of it this way: you have a string, with markers, and a list of things to insert replacing those markers. As the list has to be in order of appearance, if you want to replace two markers with the same value, the value has to show up twice.
Now, keep in mind that duplicating the parameter doesn't necessarily mean duplicating the actual data.