Synopsis: | When using composite formatting, do not supply any object unless it is referenced in the format string |
Language: | C# |
Severity Level: | 4 |
Category: | Data types |
Description: |
Composite formatting, e.g. in String.Format, uses indexed placeholders that must correspond to elements in the list of values. It is not an error to supply objects in that list that are not referenced in the format string, but it very likely a mistake. Example:
Console.WriteLine("The value is {0} and not {0}", i, j); where the second specifier was probably intended to be |