Private Constructor and Singleton design pattern

public class Singleton

{

    static readonly Singleton instance = new Singleton();

    static Singleton() //Private Constructor to make sure it cannot be instantiated out of the class bounds.

    {

    }

    public static Singleton Instance

    {

        get { return instance}

    }

}

posted on 2007-11-07 10:47  Hill Jing  阅读(301)  评论(0)    收藏  举报

导航