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.