.NET Framework Class Library
StringFormat Method (IFormatProvider, String, Object)

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.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)
Syntax
Public Shared Function Format ( _
	provider As [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_0_0_0%], _
	format As [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_0_0_1%], _
	ParamArray args As [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_0_0_2%]() _
) As [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_0_0_3%]
public static [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_1_0_0%] Format(
	[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_1_0_1%] provider,
	[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_1_0_2%] format,
	params [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_1_0_3%][] args
)
public:
static [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_2_0_0%]^ Format(
	[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_2_0_1%]^ provider, 
	[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_2_0_2%]^ format, 
	... array<[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_2_0_3%]^>^ args
)
static member Format : 
        provider:[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_3_0_0%] * 
        format:[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_3_0_1%] * 
        args:[%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_3_0_2%][] -> [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_3_0_3%]
public static function Format(
	provider : [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_4_0_0%], 
	format : [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_4_0_1%], 
	... args : [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_4_0_2%][]
) : [%$TOPIC/1ksz8yb7_en-us_VS_110_1_0_4_0_3%]

Parameters

provider
Type: SystemIFormatProvider

An object that supplies culture-specific formatting information.

format
Type: SystemString

A composite format string.

args
Type: SystemObject

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

Return Value

Type: SystemString
A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.
Exceptions
ExceptionCondition
ArgumentNullException

format or args is .

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.

Remarks
NoteNote

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

Version Information

.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