Format Method (String, Object[])

String.Format 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)

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


Type: System.String

A .

Type: System.Object[]

An object array that contains zero or more objects to format.

Return Value

Type: System.String

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

Exception Condition

format or args is null.


format is invalid.


The index of a format item is less than zero, or greater than or equal to the length of the args array.


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

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft