You frequently need to obtain a string representation for an object. Usually this is necessary when you want to display a numeric type (such as
Single, and so on) or a
DateTime object to the user. Because the .NET Framework is an object-oriented platform, every type is responsible for providing code that converts an instance’s "value" to a string equivalent. When designing how types should accomplish this, the designers of the FCL decided to devise a pattern that would be used consistently throughout. In this section, I’ll describe this pattern.
You can obtain a string representation for any object by calling the
ToString method. A public, parameterless
ToString method is defined by ...