IFormattable Interface
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Provides functionality to format the value of an object into a string representation.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Interface IFormattable
public interface IFormattable
public interface class IFormattable
type IFormattable = interface end
public interface IFormattable
The IFormattable type exposes the following members.
Methods
Name | Description | |
---|---|---|
ToString | Formats the value of the current instance using the specified format. |
Top
Remarks
The IFormattable interface converts an object to its string representation based on a format string and a format provider.
The IFormattable interface defines a single method, ToString, that supplies formatting services for the implementing type. The ToString method can be called directly. In addition, it is called automatically by the Convert.ToString(Object) and Convert.ToString(Object, IFormatProvider) methods, and by methods that use the composite formatting feature in the .NET Framework. Such methods include Console.WriteLine(String, Object), String.Format, and StringBuilder.AppendFormat(String, Object), among others. The ToString method is called for each format item in the method's format string.
The IFormattable interface is implemented by the base data types.