TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  10@407Checked automatically with code checker

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 {1} to refer to j.