Is this Singleton implementation correct and thread-safe?

后端 未结 4 2141
北荒
北荒 2020-12-15 12:14

Is this singleton implementation correct and thread-safe?

class Class
{
    public static readonly Class Instance;

    static Class()
    {
        Instance         


        
4条回答
  •  萌比男神i
    2020-12-15 12:59

    Good discussion of how to do that is here:

    http://www.yoda.arachsys.com/csharp/singleton.html

提交回复
热议问题