Thursday, September 13, 2012

Singleton Vs. Factory Pattern

Most commonly, singletons don't allow any parameters to be specified when creating the instance - as otherwise a second request for an instance but with a different parameter could be problematic! (If the same instance should be accessed for all requests with the same parameter, the factory pattern is more appropriate.)...
  • The factory pattern can be used if you need a single instance of a base type, but the exact type isn't known until runtime.
http://csharpindepth.com/Articles/General/Singleton.aspx

No comments:

Post a Comment