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);
       }

    }


    
}

  

posted @ 2016-08-01 11:27  尘梦  阅读(161)  评论(0编辑  收藏  举报