| |||||
Format Specifiers and ProvidersGetting Started ASP.NET Base Types Format SpecifiersFormat specifiers, or format strings, are one or more characters that are used to specify the kind of formatting to apply when a base type is represented as a string. Basically, a format string can be used in conjunction with any of the available formatting methods ( see Formatting Base Types ). A format specifier can be passed as a parameter by itself, or used in conjunction with a given format provider, to more precisely control how formatting is to be applied. Format specifiers fall into either of two categories: standard format strings and custom format strings. Standard format strings are those predefined by the .NET Framework for use by specific types, while custom format strings are supplied in cases where the standard format specifiers do not provide the type of formatting required. The .NET Framework provides the following set of format specifiers. Format ProvidersFormat providers define type- and culture-specific formatting models and norms, such as the calendar in use, date patterns, day and month names, decimal separators, currency symbols, and the like, that govern how the runtime renders numeric and datetime types, based on the current or a specified culture. Basically, a format provider can be used in conjunction with any of the available formatting methods ( see Formatting Base Types ). A format provider can be passed as a parameter by itself, or used in conjunction with a given format string, to more precisely control how formatting is to be applied. By default, the .NET framework base types are formatted using standard or custom patterns stored as properties in the following classes.
In cases where formatting information is needed but no format provider is passed, the information is obtained from the CultureInfo object associated with the current thread. Any class that implements the IFormatProvider interface can be used as a format provider. This means that developers can programmatically define custom formatting schemes for custom types or cultural settings. For information on creating custom format schemes, see Customizing Format Strings. See AlsoFormatting Base Types | Converting Types | Parsing Strings |
| ||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme