13.6. Summary

To format dates and numbers in C#, you specify a pattern string called a format specifier. The format specifier is a string literal of special characters that are interpreted by the runtime. For finer control of formatting, C# also supplies classes that implement the IFormatProvider interface. These classes provide other specific information, such as the culture and the symbols to be used for formatting. Java's formatting also uses a pattern string, locale information, and information about symbols to be used for formatting. Unlike Java, C# has no format-related classes; instead, formatting is done through overloaded ToString() methods on the data type itself, an approach that seems more intuitive. The format specifiers that are ...

Get .NET for Java Developers: Migrating to C# now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.