Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

String.Format Method (String, Object, Object)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Replaces the format items in a specified string with the string representation of two specified objects.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

static member Format : 
        format:string *
        arg0:Object *
        arg1:Object -> string

Parameters

format
Type: System.String

A composite format string.

arg0
Type: System.Object

The first object to format.

arg1
Type: System.Object

The second object to format.

Return Value

Type: System.String

A copy of format in which format items are replaced by the string representations of arg0 and arg1.

Exception Condition
ArgumentNullException

format is null.

FormatException

format is invalid.

-or-

The index of a format item is not zero or one.

System_CAPS_noteNote

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 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft