using System; 
using System.Threading;
using System.Text;
  
 namespace SigletonPattern.SigletonCounter 
 { 
     /**//// <summary> 
     /// 功能:简单计数器的单件模式 
     /// 编写:Terrylee 
     /// 日期:2005年12月06日 
    /// </summary> 
    public class CountSigleton 
    { 
        /**////存储唯一的实例 
        static CountSigleton uniCounter = new CountSigleton();   
    
        /**////存储计数值 
        private int totNum = 0;   
    
        private CountSigleton()  
    
        {
            /**////线程延迟2000毫秒 
            Thread.Sleep(2000); 
        }  
    
        static public CountSigleton Instance()  
    
        {  
    
            return uniCounter;  
    
        }  
         
        /**////计数加1 
        public void Add() 
        {  
            totNum ++; 
        }   
         
        /**////获得当前计数值 
        public int GetCounter() 
        {  
            return totNum; 
        }  
 
    }     public class CountMutilThread
    {
        public CountMutilThread()
        {
            
        }        /**//// <summary>
        /// 线程工作
        /// </summary>
        public static void DoSomeWork()
        {
            /**////构造显示字符串
            string results = "";            /**////创建一个Sigleton实例
            CountSigleton MyCounter = CountSigleton.Instance();            /**////循环调用四次
            for(int i=1;i<5;i++)
            {
                /**////开始计数
                MyCounter.Add();
                
                results +="线程";
                results += Thread.CurrentThread.Name.ToString() + "——〉";
                results += "当前的计数:";
                results += MyCounter.GetCounter().ToString();
                results += "\n";                Console.WriteLine(results);
                
                /**////清空显示字符串
                results = "";
            }
        }        public static void Main()
        {            Thread thread0 = Thread.CurrentThread; 
   
            thread0.Name = "Thread 0"; 
   
            Thread thread1 =new Thread(new ThreadStart(DoSomeWork)); 
   
            thread1.Name = "Thread 1"; 
   
            Thread thread2 =new Thread(new ThreadStart(DoSomeWork)); 
   
            thread2.Name = "Thread 2"; 
   
            Thread thread3 =new Thread(new ThreadStart(DoSomeWork)); 
   
            thread3.Name = "Thread 3"; 
   
            thread1.Start(); 
   
            thread2.Start(); 
   
            thread3.Start(); 
            
            /**////线程0也只执行和其他线程相同的工作
              DoSomeWork();            Console.ReadLine();
        }
    }} 以上内容运行结果顺序是按照线程0 3 2 1的顺序来显示的
但是把       
     /**////线程0也只执行和其他线程相同的工作
              DoSomeWork();
这句放到实例化线程1前面顺序就是 0 1 2 3.这是为什么啊?线程工作是按照顺序来的吗?