0

Possible Duplicate:
Named string formatting in C#

Hi, When using

string.Format("The format use argument #0 {0} and argument #1 {1}", arg0, arg1)

Is it possible to name arg0/arg1 so that the reference in the formation text becomes more meaningful, like:

string.Format("The format use argument #0 {arg0Name} and argument #1 {arg1Name}", {arg0, arg0Name}, {arg1, arg1Name})

If it can, then C# would be more lovely!

Community
  • 1
  • 1
Nam G VU
  • 30,868
  • 67
  • 216
  • 353
  • 1
    Even though it's closed, I think there was a better solution that matches your request than listed in the duplicate. I've added it there. – Doggett Nov 02 '10 at 11:21
  • Huhuhu, so sorry that I am the latecomer. The question is so hot! – Nam G VU Nov 02 '10 at 14:04
  • Doggett's answer: http://stackoverflow.com/questions/159017/named-string-formatting-in-c/4077118#4077118 – Nam G VU Nov 03 '10 at 01:29
  • @Doggett: It would be lovely if you update your answer to make your Format funtion to be String.Format – Nam G VU Nov 03 '10 at 01:29

0 Answers0