Use standard format characters in string formatting

Published 09-07-2006 1:36 PM | jokiz
Whenever you want to format a currency, date, etc. for your application, try to avoid hardcoding your custom format's in your BoundColumn's DataFormatString, ToString format parameter, etc.  More often that not, you'd want those formats to be the same application-wide so, try to configure a custom CultureInfo (whether you use a predefined or a custom one) and use the standard format characters in your format expression (c for currency, d for Short date, etc.).  

Steve Tibbett has compiled a list for string formatting here and it is my primary resource when it comes to string formatting tasks.

My current requirement is to have a configurable decimal places per currency and not to display the currency symbol so i am overriding the NumberFormatInfo of the corresponding country CultureInfo's.
Filed under: , , ,