This sample application shows how to display numeric, date-time and enumeration values as strings using a variety of standard and custom culture-specific format codes.
Microsoft Visual Studio.NET Professional or greater.
Windows 2000 or Windows XP.
Simply press F5.
1. Note that the SDK documentation states the following: "For most methods, the values returned using one of the string format specifiers have the ability to dynamically change based on the current culture or a specified culture. For example, an overload of the ToString method accepts a format provider that implements the IFormatProvider interface. Classes that implement this interface can specify characters to use for decimal and thousand separators and the spelling and placement of currency symbols. If you do not use an override that takes this parameter, the ToString method will use characters specified by the current culture."
2. The implication of this is that some ToString methods do not take format codes as an argument. For example, the ToString method for the base Object class does not use format codes because it does not implement the IFormatProvider or IFormattable interface. This can be a source of confusion when working with ToString. To work around this, you will have to cast the type to a compatible type whose ToString method implements IFormattable.