Yeah.. I know.. I'm a simpleton.. So what's a Singleton?

前端 未结 8 828
囚心锁ツ
囚心锁ツ 2020-12-05 00:47

I\'ve tried a few times to understand what a Singleton is. Perhaps I\'m just too visual.. so can anyone break it down in a simple analogy.

Similar Posts:

8条回答
  •  误落风尘
    2020-12-05 00:55

    A singleton is a class of which there can be only one instance in your application. You then share that instance throughout your application.

    Here's a link that might help (covers how to make your singleton thread safe in c# as well):

    Implementing the Singleton Pattern in C#

提交回复
热议问题