Formattable​String Class

Definition

Represents a composite format string, along with the arguments to be formatted.

public abstract class FormattableString : IFormattable
Inheritance
FormattableString
Implements

Inherited Members

System.Object

Remarks

A composite format string consists of fixed text intermixed with indexed placeholders, called format items, that correspond to the objects in the list. The formatting operation yields a result string that consists of the original fixed text intermixed with the string representation of the objects in the list. Composite formatting is supported by methods such as System.String.Format, System.Console.WriteLine, and System.Text.StringBuilder.AppendFormat. For more information on composite formatting, see Composite Formatting.

A FormattableString instance may result from the an interpolated string in C# or Visual Basic.

Constructors

Formattable​String()

Instantiates a new instance of the FormattableString class.

Properties

Argument​Count

Gets the number of arguments to be formatted.

Format

Returns the composite format string.

Methods

Get​Argument(​Int32)

Returns the argument at the specified index position.

Get​Arguments()

Returns an object array that contains one or more objects to format.

Invariant(​Formattable​String)

Returns a result string in which arguments are formatted by using the conventions of the invariant culture.

To​String()

Returns the string that results from formatting the composite format string along with its arguments by using the formatting conventions of the current culture.

To​String(​IFormat​Provider)

Returns the string that results from formatting the composite format string along with its arguments by using the formatting conventions of a specified culture.

Explicit Interface Implementations

I​Formattable.​To​String(​String, ​IFormat​Provider)

Returns the string that results from formatting the format string along with its arguments by using the formatting conventions of a specified culture.