[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Converts the value of a specified object to an equivalent string representation using specified format and culture-specific formatting information.
Assembly: mscorlib (in mscorlib.dll)
- Type: System..::..String
A format string containing formatting specifications.
- Type: System..::..Object
An object to format.
- Type: System..::..IFormatProvider
An object that supplies format information about the current instance.
Return ValueType: System..::..String
The string representation of the value of arg, formatted as specified by format and formatProvider.
is a callback method. It is called by a method that supports custom formatting, such as . The implementation is called once for each format item in a composite format string.
The arg parameter is the object in the object list whose zero-based position corresponds to the index of a particular format item.
The format parameter contains a format string, which is the formatString component of a format item. If the format item has no formatString component, the value of format is nullNothingnullptrunita null reference (Nothing in Visual Basic). If format is nullNothingnullptrunita null reference (Nothing in Visual Basic), depending on the type of arg, you may be able to use the default format specification of your choice.
The formatProvider parameter is the IFormatProvider implementation that provides formatting for arg. Typically, it is an instance of your ICustomFormatter implementation. If formatProvider is nullNothingnullptrunita null reference (Nothing in Visual Basic), ignore that parameter.
Your implementation of the method must include the following functionality so the .NET Framework can provide formatting you do not support. If your format method does not support a format, determine whether the object being formatted implements the IFormattable interface. If it does, invoke the IFormattable..::..ToString method of that interface. Otherwise, invoke the default Object..::..ToString method of the underlying object. The following code illustrates this pattern.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.