Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
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
)

Parameters

format
Type: System.String

A composite format string.

args
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.

ExceptionCondition
ArgumentNullException

format or args is null.

FormatException

format 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.

NoteNote

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft