What is a singleton in C#?

2019-01-01 06:36发布

Pretty straight forward question.

What is a Singleton and when should I use it?

13条回答
浪荡孟婆
2楼-- · 2019-01-01 07:43

Whilst the there can only ever be one instance of a singleton, it is not the same as a static class. A static class can only contain static methods and can never be instantiated, whereas the instance of a singleton may be used in the same way as any other object.

查看更多
登录 后发表回答