需要引用的包。
using System.Threading;
using System.Runtime.CompilerServices;
using System.EnterpriseServices;

解决方案 »

  1.   

    文档里说:
    对指定类型的public static成员有效。实例成员不保证有效。
      

  2.   

    对于确保静态变量和方法的同步,应该是用ThreadStaticAttribute属性吧。
      

  3.   

    public class Test
    {
       public static void Main()
       {
         for( int i=0; i<5; i++ )
         {
            TestClass tc = new TestClass();
            TestThread tt = new TestThread(tc);
            Thread t = new Thread( new ThreadStart(tt.doTest) );
            t.Start();
          }
       }
    }
      

  4.   

    m_SyncEvtBuf=ArrayList.Synchronized(EventBuffer);
    if(m_SyncEvtBuf.IsSynchronized)