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

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

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