Click or drag to resize
StringFormat Method (String, Object)
Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static string Format(
	string format,
	params Object[] args
)

Parameters

format
Type: SystemString
A composite format string (see Remarks).
args
Type: SystemObject
An object array that contains zero or more objects to format.

Return Value

Type: String
A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.
Exceptions
ExceptionCondition
ArgumentNullExceptionformat or args is null.
FormatExceptionformat is invalid.-or- The index of a format item is less than zero, or greater than or equal to the length of the args array.
See Also