Skip to Content
.NET Common Language Runtime Unleashed
book

.NET Common Language Runtime Unleashed

by Kevin Burton
April 2002
Intermediate to advanced content levelIntermediate to advanced
1024 pages
23h 26m
English
Sams
Content preview from .NET Common Language Runtime Unleashed

System.IFormatProvider

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).

Listing B.8. Numeric ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Customizing the Microsoft® .NET Framework Common Language Runtime

Customizing the Microsoft® .NET Framework Common Language Runtime

Steven Pratschner

Publisher Resources

ISBN: 0672321246Purchase book