c#danliemosih
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 打印机 { public class print { private static print instace = null; static object ce=new object(); public static print Instace { get { if (instace == null) { lock(ce) { if(instace==null) { instace = new print(); Console.WriteLine("测试"); } } } return instace; } } public void prints(object msg) { string x = (string)msg; Console.WriteLine(x); } } }