I am looking for a consistent way to structure the use of formatting strings in a large web application, and I am looking for recommendations or recommendations on how to do this.
So far I have had a static class that does some general formatting, for example.
Formatting.FormatCurrency
Formatting.FormatBookingReference
I'm not sure if this is the way to go, but I would prefer to use the standard way to format strings in .NET directly and use:
amount.ToString ("c")
reference.ToString ("000000")
Id uses IFormattable and ICustomFormatter for some of our more complex data structures, but I'm afraid of what to do with simpler existing objects that we need to format (in this case, Int32, as well as DateTime).
Am I just defining constants for "c" and "000000" and using them consistently around the entire web application or is there a more standard way to do this?
source share