Answers for "when would you used a c# singleton"

C#
0

c# singleton

public sealed class Singleton
{
    private static Singleton instance = null;
    private static readonly object padlock = new object();

    Singleton()
    {
    }

    public static Singleton Instance
    {
        get
        {
            lock (padlock)
            {
                if (instance == null)
                {
                    instance = new Singleton();
                }
                return instance;
            }
        }
    }
}
Posted by: Guest on December-21-2021

Code answers related to "when would you used a c# singleton"

C# Answers by Framework

Browse Popular Code Answers by Language