Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

singleton pattern c# stack overflow

public sealed class Singleton
{
    private static readonly Singleton instance = new Singleton();
    static Singleton() {} // Make sure it's truly lazy
    private Singleton() {} // Prevent instantiation outside

    public static Singleton Instance { get { return instance; } }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #singleton #pattern #stack #overflow
ADD COMMENT
Topic
Name
8+9 =