c# - Should a class that provides functionality be static or singelton? -


i'm writing c# app, , have class dos provide functionality different class use. example class provides clock service , more. there reason make class singelton class? or static class? or maybe should not either?

if class needs keep inner state should singelton, if doesn't make static!

inner states be:

  • a file reference
  • a user preference
  • any kind of history

if merely collection of functions etc.. math, kiss (keep static)!


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -