■
Note
If you have a mismatch between the number of uniquely numbered curly-bracket placeholders and fill
arguments, you will receive a
FormatException
exception at runtime.
It is also permissible for a given placeholder to repeat within a given string. For example, if you
are a Beatles fan and want to build the string "9, Number 9, Number 9", you would write
// John says...
Console.WriteLine("{0}, Number {0}, Number {0}", 9);
Also know that it is possible to position each placeholder in any location within a string literal,
and it need not follow an increasing sequence. For example, consider the following code snippet:
Do'stlaringiz bilan baham: |