Alternatives for the singleton pattern?

后端 未结 4 1018
既然无缘
既然无缘 2021-01-05 10:35

I have been a web developer for some time now using ASP.NET and C#, I want to try and increase my skills by using best practices.

I have a website. I want to load t

4条回答
  •  没有蜡笔的小新
    2021-01-05 10:39

    There's a good discussion of singleton patterns, and coding examples here... http://en.wikipedia.org/wiki/Singleton_pattern See also here... http://en.wikipedia.org/wiki/Dependency_injection

    For some reason, singletons seem to divide programmers into strong pro- and anti- camps. Whatever the merits of the approach, if your colleagues are against it, it's probably best not to use one. If you're on your own, try it and see.

提交回复
热议问题