April 2002
Intermediate to advanced
1024 pages
23h 26m
English
This interface provides important functionality, allowing a class that implements the methods defined in this interface to customize formatted output. The IFormatProvider interface provides custom formatting for ToString. Some custom format codes already exist for numeric data types, date and time formatting, and enumerators. You can also provide your own formatting by inheriting from the IFormatProvider interface and implementing the methods specified.
You might want to look in the online documentation for “Custom Numeric Format Strings” because the documentation there is much more detailed than this appendix is able to cover. Listing B.8 shows an example of formatting a double (iformatprovider.cs).