According to the definition in the design mode, the use of the Singleton mode is "EnSure a class HAS Only One Instance, and" Make sure that each class has only one instance, and provides its global access point) "; useing System; namespace DesignPatters.Singleton {public class Singleton {public static Singleton Instance () {if (_instance == null) {lock (typeof (Singleton)) {if (_instance == null) {_instance = new Singleton ();} }} return _instance;} public int NextValue () {return count;} protected Singleton () {} private static volatile Singleton _instance = null; private int count = 0;} public class MainClient {[STAThread] static void Main ( ) {Singleton singleton.instance (); for (int i = 0; i <20; i ) console.writeline ("Next Value: {0}", SG1.NEXTVALUE () "- sg1"); Singleton SG2 = Singleton.instance (); console.writeline ("Next Value: {0}", Sg2.nextValue () "- SG2");}}}