|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A design question about format providerI 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) Nick nkw wrote: Show quote > 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. > > |
|||||||||||||||||||||||