Search notes:

.NET: formatting and parssing

Formatting is the process of converting an object into a string representation.
Parsing is the opposite: an object is created from a string representation.

ToString()

Because formatting is quite a fundamental operation, it warrants a (default) implementation in the root of all objects: Object.ToString(). By default, ToString() returns the fully qualified name of the object's type.
Because in most cases the object's type name is not too interesting, derived classes override ToString() to create a custom representation of an object.
In fact, some classes even provide more than one version of ToString(). For example, The System.Int32 type has for ToString() methods that allow to specify in more detail how the value is to be formatted.

See also

The System.IFormattable and System.IFormatProvider interfaces.
.NET: format strings

Index