I know that the following syntax works
String.Format("Today is {0}, {1}", day,month);
I was just curious how this format works?
String.Format("Today is {day}, {month}", day,month);
How does C# interpret replacing number with user defined names?
String.Format("Today is {day}, {month}", day,month);
Does not work, it throws a System.FormatException
.
According to the documentation the replacement fields must be in the format { index[,alignment][:formatString]}
which your 2nd example does not follow.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments