Thread-ApartmentState


 [Obsolete("The ApartmentState property has been deprecated.  Use GetApartmentState, SetApartmentState or TrySetApartmentState instead.", false)]
        public ApartmentState ApartmentState
        {
            [System.Security.SecuritySafeCritical]  // auto-generated
            get
            {
                return (ApartmentState)GetApartmentStateNative();
            }
 
            [System.Security.SecuritySafeCritical]  // auto-generated
            [HostProtection(Synchronization=true, SelfAffectingThreading=true)]
            set
            {
                SetApartmentStateNative((int)value, true);
            }
        }

是一个枚举

    [Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
    public enum ApartmentState
    {   
        /*=========================================================================
        ** Constants for thread apartment states.
        =========================================================================*/
        STA = 0,
        MTA = 1,
        Unknown = 2
    }
}
 
 成员名称说明
  MTA

Thread will create and enter a multithreaded apartment.">Thread 将创建并进入一个多线程的单元。

  STA

Thread will create and enter a single-threaded apartment.">Thread 将创建并进入一个单线程单元。

  Unknown

ApartmentState property has not been set.">ApartmentState 未设置属性。