A design question about format provider

  • Thread starter Thread starter Nick nkw
  • Start date Start date
N

Nick nkw

I am building an asp.net application. However, it had to use a lot of
Convert.ToDatetime or Parse. And I had a lot of the following code:

IFormatProvider provider = new
CultureInfo(ConfigurationManager.AppSettings.Get("culture"));
.... DateTime.Parse(lblDate.Text, provider)...
.... Convert.ToDateTime(..., provider)....

Is refactoring the one line to an singleton worth? Sounds it save a little
bit typing.
 
the advantage of the singleton is abstraction of the method. you ca
change the formating style in one place.

-- bruce (sqlwork.com)
 
Back
Top