System.ICustomFormatter

Defines a method that supports custom formatting of the value of an object.

See Also: ICustomFormatter Members

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public interface ICustomFormatter

Remarks

The ICustomFormatter interface includes a single method, ICustomFormatter.Format(string, object, IFormatProvider). When this interface is implemented by a reference or value type, the ICustomFormatter.Format(string, object, IFormatProvider) method returns a custom-formatted string representation of an object's value.

Typically, the ICustomFormatter interface is implemented with the IFormatProvider interface to customize the behavior of two .NET Framework composite string formatting methods that include an IFormatProvider parameter. Specifically, the ICustomFormatter interface can provide custom formatting of the value of an object passed to the string.Format(IFormatProvider, string, Object[]) and System.Text.StringBuilder.AppendFormat(IFormatProvider, string, Object[]) methods.

Providing a custom representation of an object's value requires that you do the following:

[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]

The .NET Framework method will then use your custom formatting instead of its own.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0