Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# Singleton

public sealed class Singleton
{
    private static readonly Lazy<Singleton> lazy =
        new Lazy<Singleton>(() => new Singleton());

    public static Singleton Instance { get { return lazy.Value; } }

    private Singleton()
    {
    }
}
Source by csharpindepth.com #
 
PREVIOUS NEXT
Tagged: #Singleton
ADD COMMENT
Topic
Name
6+2 =