次の方法で共有


Formatting Types 

The .NET Framework provides a consistent, flexible, and comprehensive means for you to represent any of the numeric, enumeration, and date and time base data types as a string. Formatting is controlled by strings of format specifier characters that indicate how a base type value is to be represented. For example, format specifiers indicate whether a formatted number should be represented in scientific notation, or whether a formatted date should present the month as a number or a name.

The .NET Framework also uses cultural settings to represent a base type in a form appropriate to a particular culture. You can supply custom cultural settings, or use the default cultural setting associated with the current thread. For example, when formatting a currency type, the cultural setting specifies the characters to use for the currency symbol, group separator, and decimal separator.

The .NET Framework allows you to define custom formatting schemes and custom cultural settings. This ability enables you to expand the formatting schemes of existing base types to accommodate custom scenarios, or create custom formatting schemes for custom types.

In This Section

  • Formatting Overview
    Provides an overview of how the base class library implements formatting, how to format numeric types, how to format string types, and how to format for a specific culture.
  • Composite Formatting
    Describes how to embed one or more formatted values in a string. The string can subsequently be displayed on the console or written to a stream.
  • Numeric Format Strings
    Describes standard and custom format strings used to create string representations of numeric types.
  • Customizing Format Strings
    Provides information about performing your own interpretation of format strings, or adding custom format strings to custom or existing types.
  • Parsing Strings
    Describes how to initialize objects to the values described by string representations of those objects. Parsing is the inverse operation of formatting.