Formatting methods (such as String.Format()) that are missing arguments will throw the exception System.FormatException. This is caused by the format string not matching the actual arguments supplied or an incorrect format string.

Supply the correct number of arguments to the format method, or change the format string to use the correct arguments.

Here are two examples where the call to String.Format() is missing arguments.

  • On line 5, the second argument (last) is not supplied.
  • On line 6, the format items are numbered {1} and {2}, instead of {0} and {1} as they should be.

In the revised example, both arguments are supplied.

  • MSDN: String.Format Method.
  • Microsoft: Composite Formatting.