System.String.Format Method

Replaces the format items in a specified string with the string representations of corresponding objects in a specified array. A parameter supplies culture-specific formatting information.

Syntax

public static string Format (IFormatProvider provider, string format, params object[] args)

Parameters

provider
An object that supplies culture-specific formatting information.
format
A composite format string.
args
An object array that contains zero or more objects to format.

Returns

A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.

Exceptions

TypeReason
ArgumentNullException format or args is a null reference.
FormatException

format is invalid.

-or-

The number indicating an argument to be formatted (N) is less than zero, or greater than or equal to the length of the args array.

Remarks

Note:

For examples and comprehensive usage information about this and other overloads of the Format method, see the erload:System.String.Format overload summary.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0