Skip to main content
.NET Framework Class Library
StringFormat Method (String, Object)

Replaces one or more format items in a specified string with the string representation of a specified object.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)
Syntax
Public Shared Function Format ( _
	format As [%$TOPIC/fht0f5be_en-us_VS_110_1_0_0_0_0%], _
	arg0 As [%$TOPIC/fht0f5be_en-us_VS_110_1_0_0_0_1%] _
) As [%$TOPIC/fht0f5be_en-us_VS_110_1_0_0_0_2%]
public static [%$TOPIC/fht0f5be_en-us_VS_110_1_0_1_0_0%] Format(
	[%$TOPIC/fht0f5be_en-us_VS_110_1_0_1_0_1%] format,
	[%$TOPIC/fht0f5be_en-us_VS_110_1_0_1_0_2%] arg0
)
public:
static [%$TOPIC/fht0f5be_en-us_VS_110_1_0_2_0_0%]^ Format(
	[%$TOPIC/fht0f5be_en-us_VS_110_1_0_2_0_1%]^ format, 
	[%$TOPIC/fht0f5be_en-us_VS_110_1_0_2_0_2%]^ arg0
)
static member Format : 
        format:[%$TOPIC/fht0f5be_en-us_VS_110_1_0_3_0_0%] * 
        arg0:[%$TOPIC/fht0f5be_en-us_VS_110_1_0_3_0_1%] -> [%$TOPIC/fht0f5be_en-us_VS_110_1_0_3_0_2%]
public static function Format(
	format : [%$TOPIC/fht0f5be_en-us_VS_110_1_0_4_0_0%], 
	arg0 : [%$TOPIC/fht0f5be_en-us_VS_110_1_0_4_0_1%]
) : [%$TOPIC/fht0f5be_en-us_VS_110_1_0_4_0_2%]

Parameters

format
Type: SystemString

A composite format string.

arg0
Type: SystemObject

The object to format.

Return Value

Type: SystemString
A copy of format in which any format items are replaced by the string representation of arg0.
Exceptions
ExceptionCondition
ArgumentNullException

format is .

FormatException

The format item in format is invalid.

-or-

The index of a format item is not zero.

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