[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Defines a method that supports custom formatting of the value of an object.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
The interface includes a single method, ICustomFormatter..::..Format. When this interface is implemented by a reference or value type, the Format method returns a custom-formatted string representation of an object's value.
Typically, the interface is implemented with the IFormatProvider interface to customize the behavior of .NET Framework string formatting methods that include an IFormatProvider parameter. For example, the interface can provide custom formatting of the value of an object passed to the method.
Providing a custom representation of an object's value requires that you do the following:
Define a class that implements the interface and its single member, the Format method.
Define a class that implements the IFormatProvider interface and its single member, the GetFormat method. The GetFormat method returns an instance of your implementation. Often, a single class implements both and IFormatProvider. In that case, the class's GetFormat implementation just returns an instance of itself.
Pass the IFormatProvider implementation as the provider argument of the method or a comparable method.